chmod: a Unix utility for managing file permissions
Modes can be expressed in octal or human-readable:
Description | Octal | Human-readable
----------------------------------+--------+---------------
Set user write | 200 | u=w
Set user rwx, group and others rx | 755 | u=rwx,go=rx
Add group read | - | g+w
Remove all execute | 111 | a-x
Set user rws, everyone else none | 4700 | u=rwxs,go-rwx
Add user sticky | - | u+s
Add group sticky | - | g+s
Example: Make foo u=rwx and go=rx:
$ chmod u=rwx,go=rx foo
Example: Make foo u=rwx and go=rx (in octal):
$ chmod 755 foo
Example: Find all subdirectories, put them in 'mygroup', make them group sticky:
$ find . -type d -exec chgrp mygroup \{\} \;
$ find . -type d -exec chmod g+s \{\} \;