2

I have a user and a group called awe on my server.

It's home directory is /home/awe

I created a new user called c37. I then ran the following command (as root)

usermod -a -G awe c37

Now when I'm logged in as c37 and type groups I get: c37 awe

But yet when I run the following commands as c37: cd /home/awe/ ls -l

/bin/ls: cannot open directory .: Permission denied

Why is this? I thought adding a user to that group would give me permission to access everything that the user awe has access to?

0

2 Answers 2

1

By default, home directories are created with permissions set only for the user, not for the group. Running the following will allow you to access that folder:

sudo chmod g+rX ~awe

The command chmod alters permissions on files and folders. The command above adds (+) read (r) and access directory (X) to anyone on the file/folder's (~awe) owner's main group (g).

4
  • can you explain what g+rX does? I can't find any of them in the man pages
    – Chud37
    May 17, 2016 at 7:42
  • @Chud37 added further explanation May 17, 2016 at 7:46
  • Okay, I just ran that command and now my server is down! is there a way to undo it?
    – Chud37
    May 17, 2016 at 8:14
  • @Chud37 that command is safe and innocuous, it can't cause a system to stop functioning in any way. In any case, the way to remove the access you granted is sudo chmod g= ~awe (note the space after =) May 17, 2016 at 8:17
0

It is not enough to add a user to a group. The appropriate permissions should be grant for a group on files/directories.

Check permissions of the ~awe directory:

ls -ld ~awe

most likely you would see

drwx------. 14 awe awe 4096 May 16 15:37 /home/awe

to fix this run the following command while logged in as awe (or root):

chmod g+rx ~awe

if you need write access as well, then use this command:

chmod g+rwx ~awe

Please read this question on how to interpret the access bit names

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .