Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. ## HOWTO
  2.  
  3. To set up permissions on /var/www where your files are served from by default:
  4.  
  5. ```
  6. sudo addgroup webmasters
  7. sudo adduser $USER webmasters
  8. sudo chown -R root:webmasters /var/www
  9. sudo find /var/www -type f -exec chmod 664 {} \;
  10. sudo find /var/www -type d -exec chmod 775 {} \;
  11. sudo find /var/www -type d -exec chmod g+s {} \;
  12. sudo chown -R www-data:webmasters application/cache/ [etc...]
  13. ```
  14.  
  15. Now log out and log in again to make the changes take hold.
  16.  
  17. The previous set of commands does the following:
  18.  
  19. * Create a new group called webmasters; all users who need write access to the app files will be added to this group.
  20. * adds the current user ($USER) to the webmasters group.
  21. * changes the owner of /var/www to root and the group to webmasters group.
  22. * adds 664 permissions (-rw-rw-r--) to all files in /var/www .
  23. * adds 775 permissions (drwxrwxr-x) to all directories in /var/www .
  24. * sets the SGID bit on /var/www and all directories therein; this final point bears some explaining.
  25. Note also that you can also put a 2 at the front of your chmod octal (e.g. 2644) to do the same thing.
  26. sets the owner to www-data (Apache's user) and group of the supplied directory to webmaster. This ensures the directory is writable by Apache and anyone in the webmasters group. Do the same for all other directories that need to be writable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement