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?

Chud37
  • 179

2 Answers2

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).

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

Serge
  • 8,541