Thursday, February 3, 2011

Why cant a group member modify a file in a group he is part of?

-edit- i figured it out. I needed to use adduser username group instead.

I added a user with the command

useradd -G myapp_user newusername

then i changed the group on the public folder that i want the user to access. Here is the line using ls -l I see the group has been set.

drwxrwxr-x 3 root myapp_user 4096 Jul  9 19:13 public

I cd into it and do it again to and i see files like the below with the group. I also see rwx on both the public folder and on the content inside the directory.

-rwxrwxr-x 1 root myapp_user   4403 Oct 10  2007 info.png

Then i login as the user and CD into the folder i wrote touch a and i got a permission error. I cant add, delete or do anything even though i see 775 is the permission. I also tried useradd -G myapp_user newusername to find the user is already part of the group

what am i missing? am i suppose to flush something before it takes effect? restart something? why cant the user modify anything in the public folder?

using putty and winscp. But right now just putty.

-edit- i wrote id newusername and got the below. Why isnt the groupname included?!

uid=1000(newusername) gid=1000(newusername) groups=1000(newusername)
  • Put the newusername into the myapp_user group with gpasswd -a newusername myapp_user. You should close any open session for newusername and perform a new login for the new group to be effective.

    From joschi
  • use adduser username group instead

  • You setup the groups correctly, but the user's list of groups is set when they first login, and won't normally ever be re-evaluated. If you make a change to a user's list of groups, you either need to log out and log back in, or you need to run the newgrp command.

0 comments:

Post a Comment