Hi brand new setup here.

ls -ld /var/www drwxr-xr-x 3 www-data www-data 4096 Feb 25 18:10 /var/www 

so above shows that /var/www belongs to www-data

I then add current user to www-data

sudo usermod -a -G www-data ahdee groups ahdee ahdee : ahdee sudo www-data 

however while in /var/www I tried this and still got permission denied.

echo "hi" > t.txt mkdir test 

A bit confused because the owner is www-data and ahdee belongs to that group so why can't I write to it?

thanks in advance.

3

1 Answer

The first "www-data" is the owner of the file, the second "www-data" is the group.

In the ls -l, the first block shows the access rights:

drwxr-xr-x d it's a directory rwx the owner www-data may read, write and enter the directory r-x members of the group www-data (e.g. you) may read and enter, but not write in there (e.g. create a new file) r-x others may read and enter, too, but not write. 

So, you'd have to change the permissions, so that group members may write: chmod g+w /var/www

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy