Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
user@ubuntu:/var/www$ sudo addgroup webwork
[sudo] password for user: 
user@ubuntu:/var/www$ sudo chmod g+s /var/www
user@ubuntu:/var/www$ sudo chown :webwork /var/www
user@ubuntu:/var/www$ ls -l ../www
total 4
-rw-r--r-- 1 root root 177 2011-12-13 15:48 index.html

user@ubuntu:/var/www$ sudo usermod -aG webwork user
user@ubuntu:/var/www$ ls -l ../www
total 4
-rw-r--r-- 1 root root 177 2011-12-13 15:48 index.html

user@ubuntu:/var/www$ ls > t.txt
bash: t.txt: Permission denied

user@ubuntu:/var/www$ uname -n
ubuntu
user@ubuntu:/var/www$ whoami
user

I simply want to create a group of webwork and add the current user of user to this group so that it can modify the folder of \var\www.

Question> Why after running the above statement, the user still have no permission to modify the folder /var/www?

Thank you

// Update -- after logout and login //

user@ubuntu:/var/www$ ls -l
total 4
-rw-r--r-- 1 root root 177 2011-12-13 15:48 index.html
user@ubuntu:/var/www$ ls > t.txt
bash: t.txt: Permission denied
share|improve this question

migrated from stackoverflow.com Dec 13 '11 at 22:18

This question came from our site for professional and enthusiast programmers.

    
Your ls command only shows the permissions of the contents of /var/www. Could you run ls -l /var and post the results? –  sudo Dec 13 '11 at 22:51

1 Answer 1

up vote 1 down vote accepted

Log out and log in again.

Each running process has its own credentials – user, group, secondary group list. When you run usermod -aG, you only update the user's information on disk, but you cannot update the group list of currently running shells. You can see it by running groups or id (shows current credentials) and comparing with groups user or id user (shows information on disk).

Also, make sure your group actually has write access (+w) to the directory. Add it with sudo chmod g+w /var/www.

share|improve this answer
    
I have tried and it doesn't work for me. –  q0987 Dec 13 '11 at 22:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.