| Complete table of chmod numbers | ||
|---|---|---|
| Number | Permission | Sum |
| 0 | – – – | 0+0+0 |
| 1 | – – x | 0+0+1 |
| 2 | – w – | 0+2+0 |
| 3 | – w x | 0+2+1 |
| 4 | r – – | 4+0+0 |
| 5 | r – x | 4+0+1 |
| 6 | r w – | 4+2+0 |
| 7 | r w x | 4+2+1 |
CHECK THE FILE’S PERMISSIONS IN THE NUMERIC NOTATION:
$ stat -c "%a" filename
$ chmod 644 dirname
$ chmod -R 700 dirname
$ chmod -R 755 /var/www <<= recursively applies to all files & subdirectories
CHANGING FILE PERMISSIONS IN BULK
Using the numeric method:
$ find /var/www/my_website -type d -exec chmod 755 {} \;
$ find /var/www/my_website -type f -exec chmod 644 {} \;
Using the symbolic method:
$ find /var/www/my_website -type d -exec chmod u=rwx,go=rx {} \;
$ find /var/www/my_website -type f -exec chmod u=rw,go=r {} \;
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.