NFS share access - Permission denied

32,102

Solution 1

Verify that the directory actually is exported with no_root_squash:

grep git /proc/fs/nfs/exports

Do 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 nfs
  • rpcinfo -T udp server mountd
  • rpcinfo -T udp server nlockmgr

Solution 2

Using fsid=0 in export options may help for accessing files and directories with no read permission for others. See - http://softpanorama.net/Net/Linux_networking/Suse_networking/suse_nfs.shtml

Share:
32,102

Related videos on Youtube

rgngl
Author by

rgngl

Updated on September 18, 2022

Comments

  • rgngl
    rgngl over 1 year

    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 git
    

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

  • rgngl
    rgngl over 11 years
    I confirmed through /proc/fs/nfs/exports that no_root_squash is enabled. /var/log/nfs on the server is empty and in /var/log/messages says authenticated mount request from the client, nothing else.
  • rgngl
    rgngl over 11 years
    Plus, sestatus is not present on the server so I assume there's no SELinux installation.
  • rgngl
    rgngl over 11 years
    I don't get any error during mount operation, it seems to mount fine. From the log folder I only see the messages file is updated. It says the mount authentication was successful.
  • yzfr1
    yzfr1 over 11 years
    Oh, I'm sorry, I completely misunderstood your problem. I usually mount with the parameter "-o rw,soft", maybe you can try that?
  • Ansgar Wiechers
    Ansgar Wiechers over 11 years
    @rgngl See updated answer.
  • rgngl
    rgngl over 11 years
    Hi, the situation has changed a bit. I updated my question. Now I have r/w access from the client when I'm logged in there as root. But with the git user, I still get the permission denied error.
  • nod
    nod over 10 years
    You may give no_all_squash a try (no_root_squash is irrelevant - root already has access). Also, as root on the client, you could try "chown git.git git". Also, adding a unique "fsid=" to each export is essential in many environments. The value doesn't need to be zero, just make sure all are unique (e.g. 1st export fsid=10, 2nd export fsid=20, etc.)
  • GuySoft
    GuySoft almost 6 years
    Or change fsid to anything else apart from root if you need lower permissions