Permission denied write to directories with g + w mode on ubuntu

On ubuntu server 10.04.4 I did this:

sudo mkdir -p /data/somedir
sudo chown -R www-data.www-data /data/somedir
sudo chmod -R g+w /data/somedir
sudo usermod -a -G www-data john ##john is current login user.

. With these operations, I assume that I have write permission to /data/somedir. But when I did this:

echo "123" > /data/somedir/123

I got:

-bash: /data/somedir/123: Permission denied

Output ls -l:

$ ls -l /data/
total 4
drwxrwxr-x 2 www-data www-data 4096 2012-04-24 22:30 somedir

Question: why? Anything else I need to do after this?

+3
source share
1 answer

Changes made with the help usermod, enter into force only after entering the system; Your existing login session does not yet have a group www-data, as you can check with id. It is not easy to change the identity of running processes (it newgrpcan work); the easiest way is to log out and return.

+3
source

All Articles