Giving user access to /var/www folder

/ Published in: Bash
Save to your folder(s)

Copy this code and paste it in your HTML
  1. # To best share with multiple users who should be able to write in /var/www,
  2. # it should be assigned a common group. For example the default group for web content on Ubuntu
  3. # and Debian is www-data. Make sure all the users who need access to /var/www are in this group.
  4. sudo usermod -a -G www-data <some_user>
  5. #Then set the correct permissions on /var/www.
  6. sudo chgrp -R www-data /var/www
  7. sudo chmod -R g+w /var/www
  8. #Additionally, you should make the directory and all directories below it "set GID", so that all new files and directories created under /var/www are owned by the www-data group
  9. sudo find /var/www -type d -exec chmod 2775 {} \;
  10. #Find all files in /var/www and add read and write permission for owner and group:
  11. sudo find /var/www -type f -exec chmod ug+rw {} \;

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.