Code
linux
# Octal and symbolic modes
chmod 755 script.sh # rwxr-xr-x
chmod 644 config.yml # rw-r--r--
chmod u+x deploy.sh # add execute for owner
chmod g-w,o-r secret.key # remove group write, other read
# Recursively set dirs and files separately
find /var/www -type d -exec chmod 755 {} +
find /var/www -type f -exec chmod 644 {} +
# Ownership
chown alice:devs file.txt
chown -R alice:devs /var/www
# Special bits
chmod +t /tmp # sticky bit
chmod g+s /shared # setgid: inherit group
chmod u+s /usr/bin/binary # setuid: run as owner
# ACL for fine-grained access
setfacl -m u:bob:rw- report.txt
getfacl report.txt