Chmod Practices

Batch Change

$ chmod -R 644 /your\_path
$ find /path -type d -exec chmod 755 {} \;
$ find /path -type f -exec chmod 644 {} \;

See: Command Substitution

Web Permissions

$ chmod -R 644 /var/www/html/
$ chmod 644 .htaccess
$ chmod 644 robots.txt
$ chmod 755 /var/www/uploads/
$ find /var/www/html -type d -exec chmod 755 {} \;

SSH Permissions

$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorized\_keys
$ chmod 600 ~/.ssh/id\_rsa
$ chmod 600 ~/.ssh/id\_rsa.pub
$ chmod 400 /path/to/access\_key.pem
Comments