whatis chmod

chmod

Also known as: change mode

The command that changes a file's permission bits, using either octal numbers (chmod 644) or symbolic notation (chmod u+x).

What Does chmod Do in Linux?

Octal mode sets all bits at once: chmod 600 key.pem makes a file readable and writable only by its owner. Symbolic mode adjusts specific bits: chmod g+w file adds group write, chmod o-r file removes read for others.

chmod -R recurses, but applying one mode to files and directories alike is a common mistake. find with -type f and -type d, or the capital X symbol, sets execute only where it belongs.

Example

chmod 755 deploy.sh
chmod -R u=rwX,go=rX /srv/www