NFS share access - Permission denied
Edited, as the situation changed a little bit.
I'm trying to share a directory on my NAS device(WD Mybook WE) with NFS to another machine on my local network. The directory on the NAS device looks like this:
drwxr-x--- 15 git git 4096 Nov 17 01:05 git/And id's of the user git on the NAS device is like this:
[root@myhost DataVolume]# id git
uid=505(git) gid=505(git)I played with many different parameters in the /etc/exports file and this is what I got there currently:
/DataVolume/git 192.168.0.20(async,rw,no_root_squash)On the client side I have the user git and group git with the same id's to match the ones on the server.
user@myclient:~$ id git
uid=505(git) gid=505(git) groups=505(git)I mount the directory with:
sudo mount myhost:/DataVolume/git -t nfs git/and the mounted directory looks like:
drwxr-x--- 15 git git 4096 Nov 17 01:05 gitAfter these steps I can access to this directory from the client with the root user with r/w permissions. But user git on the client still cannot even cd into that directory. The git user has the same uid and gid on both devices and as you can see the directory is owned by that user.
Thanks in advance for any help.
3 Answers
Verify that the directory actually is exported with no_root_squash:
grep git /proc/fs/nfs/exportsDo you have SELinux enabled on client or server? If so, try disabling it (or set the policy to permissive), then restart nfsd and remount the share.
What do your logs (client and server) say about this?
Edit:
Do you see the mounts/exports when you run showmount -a server and showmount -e server on the client?
Do you get ready and waiting responses when running the following three commands on the client?
rpcinfo -T udp server nfsrpcinfo -T udp server mountdrpcinfo -T udp server nlockmgr
Using fsid=0 in export options may help for accessing files and directories with no read permission for others. See -
1You should check the sylog for more information on why you're getting the Access Denied error. Run the following command to check what log files have recently been edited, and then check the last lines of those files.
ls -latr /var/log/
I once had the same problem with NFS, everything seemed to be set up right, but whatever I did I always got an "access denied by server while mounting xxx" error. The logs showed an "Illegal Port" error and I solved it by adding the option "insecure" to the exports file, ie:
/DataVolume/git 192.168.0.20(async,rw,no_root_squash,no_subtree_check,insecure)
Try that and see if it gets you any closer.
2