This directory of Linux commands is from Linux in a Nutshell, 5th Edition.
Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.
chmod [options] mode files chmod [options] --reference=filename files
Change the access mode (permissions) of one or more files. Only the owner of a file or a privileged user may change the mode. mode can be numeric or an expression in the form of who opcode permission. who is optional (if omitted, default is a); choose only one opcode. Multiple modes are separated by commas.
Alternatively, specify permissions by a three-digit octal number. The first digit designates owner permission; the second, group permission; and the third, other's permission. Permissions are calculated by adding the following octal values:
Note that a fourth digit may precede this sequence. This digit assigns the following modes:
Add execute-by-user permission to file:
chmod u+x file
Either of the following will assign read/write/execute permission by owner (7), read/execute permission by group (5), and execute-only permission by others (1) to file:
chmod 751 file chmod u=rwx,g=rx,o=x file
Any one of the following will assign read-only permission to file for everyone:
chmod =r file chmod 444 file chmod a-wx,a+r file
The following makes the executable setuid, assigns read/write/execute permission by owner, and assigns read/execute permission by group and others:
chmod 4755 file