I have added the user "test" in myuser group usermod -a -G test myuser
. But if I try to execute or try to cd to datadir
as "test" user gives the Permission denied error. datadir
is having the following privilege 770
and the user "test" belongs to myuser
group and still it gives the Permission denied error.
drwxrwx--- 3 myuser myuser 4096 Feb 6 16:24 datadir
$ grep "^test" /etc/group
test:x:503:myuser
$ groups myuser
myuser : myuser test
Best Answer
You did not tell us about the parent directories permissions of
datadir
. Even if you have full permissions to a folder, you will not be able to access it unless you have the appropriate permissions to its parents also. So, you need to look at the full path permissions. For example, if you have a hierarchy like:You should check the permissions of
subdir
and/var
also. This is just an illustrative example.