Write permissions in /var/www folder

12,721

this line sudo chown -R www-data:www-data /var/www made the directory to user www-data so other user can't write, why not try something like chown -R :www-data /var/www

Share:
12,721

Related videos on Youtube

xylar
Author by

xylar

Updated on September 18, 2022

Comments

  • xylar
    xylar almost 2 years

    I followed the steps from https://askubuntu.com/a/51337/115811 to add my user to a www-data group and set the /var/www/ dir group writeable.

    sudo adduser <username> www-data
    sudo chown -R www-data:www-data /var/www
    sudo chmod -R g+rw /var/www
    

    This is /var/www/ contents:

    drwxrwsr-x  2 www-data www-data 4096 Oct 25 08:13 ./
    drwxr-xr-x 14 root     root     4096 Oct 17 08:47 ../
    -rwxrwsr-x  1 www-data www-data  177 Oct 17 23:51 index.html*
    

    However when I try to git clone or mkdir in /var/www/, I am still getting "Permission denied". What am I missing?

    • chaos
      chaos over 10 years
      Can you post the output of the command groups with your user <username>, that should have access?
    • nickanor
      nickanor over 10 years
      this line sudo chown -R www-data:www-data /var/www made the directory to user www-data so other user can't write, why not try something like chown -R :www-data /var/www
    • web.learner
      web.learner over 10 years
      @nickanor Perhaps you could add that as an answer?
  • 5d41402abc4
    5d41402abc4 about 10 years
    be careful when you use 777 permission. Your folders or files will be accessed by everyone. For security reason this is not recommended.