chmod[option]modefiles
Change the access mode of one or more files. Only the owner of a
file or a privileged user may change its mode.
Create mode by concatenating the
characters from who, opcode, and permission.
who is optional (if omitted, default is a); choose only one opcode.
Recursively descend directory arguments while setting modes.
suppress error message upon failure to change a file's mode.
User
Group
Other
All (default)
Add permission
Remove permission
Assign permission (and remove permission of the unspecified fields)
Read
Write
Execute
Set user (or group) ID
Sticky bit; save text (file) mode or prevent removal of files by nonowners (directory)
User's present permission
Group's present permission
Other's present permission
Mandatory locking
Alternatively, specify permissions by a 3-digit sequence. The first digit designates owner permission; the second, group permission; and the third, others permission. Permissions are calculated by adding the following octal values:
Read
Write
Execute
Note: A fourth digit may precede this sequence. This digit assigns the following modes:
Set user ID on execution
Set group ID on execution or set mandatory locking
Set sticky bit
Add execute-by-user permission to file:
chmod u+xfile
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 751filechmod u=rwx,g=rx,o=xfile
Any one of the following will assign read-only permission to file for everyone:
chmod =rfilechmod 444filechmod a-wx,a+rfile
Set the user ID, assign read-write-execute permission by owner, and assign read-execute permission by group and others:
chmod 4755file