I've created an NFS Debian server with the following line in the exports file
/home/remote 10.255.255.108(rw,sync,no_subtree_check) 10.255.255.101(rw,sync,no_subtree_check,all_squash)
The directory belongs to a user and group with uid and gid that were set by me to known values.
On the client side I do (as root)
mount -t nfs pc00:/home/remote /home/NFS/
Now when I do ls -la on the directory in my PC I have the correct local user and group (which were created with the same GID and UID values as the user and group in the server)
drwxrwx---. 5 pepito laspruebas 4096 Mar 28 11:55 NFS
However when I try to CD into the folder (as my user ariela):
[ariela@pc01 home]$ cd NFS/
bash: cd: NFS/: Permission denied
I should add that ariela belongs to group laspruebitas and If I try to cd into the folder when it is not mounted, there is no issue.
What am I doing wrong? I would like a solution that is not to set the folder permissions to 777.
EDIT: I have try entering the /home/NFS folder as root and cannot do it.
Best Answer
In case anyone comes across this, I've solved this problem. But you need to make sure of two things: 1) that the group (in this case laspruebas) is your primary group. This can be accomplished permanently for the console with (
newgrep laspruebas
) or temporarily for one comand withsg
AND 2) You must make sure that the directory has the x (execution permission) for the owner, group or others to be able to CD into it.