1

I'm having some troubles with reading a NFS mount.

I have server1 and client1. They are both SLES 12 SP1.

server1:

server1:/ # cat /etc/exports
/usr/zap/trans  *(rw,root_squash,sync,no_subtree_check)

server1:/ # ls -ld /usr/zap/trans
drwxrwx--x 13 root zapsys 4096 Feb 29 18:46 /usr/zap/trans

server1:/ # exportfs -av
exporting *:/usr/zap/trans

I can mount the NFS share without problems on client1:

client1:/ # mount -v -t nfs4 server1:/usr/zap/trans /mnt
mount.nfs4: timeout set for Thu Jun 30 22:32:09 2016
mount.nfs4: trying text-based options 'addr=10.1.2.4,clientaddr=10.1.2.3'

client1:/ # mount | grep server1
server1:/usr/zap/trans on /mnt type nfs4 (rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.1.2.3,local_lock=none,addr=10.1.2.4)

client1:/ # ls -ld /mnt
drwxrwx--x 13 root zapsys 4096 Feb 29 18:46 /mnt

Rpcinfo and showmount also work without a problem:

client1:/ # rpcinfo -p server1
   program vers proto   port  service
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100024    1   udp  61493  status
    100024    1   tcp  32256  status
    100005    1   udp  20048  mountd
    100005    1   tcp  20048  mountd
    100005    2   udp  20048  mountd
    100005    2   tcp  20048  mountd
    100005    3   udp  20048  mountd
    100005    3   tcp  20048  mountd
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    3   tcp   2049  nfs_acl
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    3   udp   2049  nfs_acl
    100021    1   udp  26684  nlockmgr
    100021    3   udp  26684  nlockmgr
    100021    4   udp  26684  nlockmgr
    100021    1   tcp  22369  nlockmgr
    100021    3   tcp  22369  nlockmgr
    100021    4   tcp  22369  nlockmgr
client1:/ # showmount -e server1
Export list for server1:
/usr/zap/trans *

The problem is when I try to read the content of the mounted directory on client1 I get a permission denied. However, I can do a listing of a specific directory as seen below:

client1:/ # ls -l /mnt
ls: cannot open directory /mnt: Permission denied
client1:/ # ls -l /mnt/lost+found
ls: cannot open directory /mnt/lost+found: Permission denied
client1:/ # ls -ld /mnt/lost+found
drwx------ 2 root root 16384 Feb 29 12:51 /mnt/lost+found
client1:/ # ls -l /mnt/tmp
ls: cannot open directory /mnt/tmp: Permission denied
client1:/ # ls -ld /mnt/tmp
drwxrwx--x 2 root zapsys 4096 Feb 29 18:46 /mnt/tmp

I don't understand why this is happening. Somebody got a clue?

  • 4
    Because of that root_squash option, root on the client is mapped to nobody or nfsnobody on the server, and likely only has the access denoted by the "other" portion of the directories' perms. In your sample directories, those perms are x but not r. What userid would you like root on clients to be mapped to on the server? – Mark Plotnick Jun 30 '16 at 21:15
  • Mark, thanks. Your answer is correct. Changing root_squash to no_root_squash solved the problem. Root_squash is not needed in our use case because the directory will be accessed as root only. – Martin Pas Jun 30 '16 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.