0

I figured out that I am able to mount a path above my nfs export.

/etc/exports:

/home/max/shared      192.168.10.0/24(rw,sync,subtree_check)

This works and I can access the remote share.

mount 192.168.10.99:/ /mnt

But I expected that only a mount of the full path (/home/max/shared) would work.

NFS v4, Debian 9

Am I wrong or what's the problem?

3
  • Are you sure it's nfs v3 and not v4? And there's no other export of /? – Jeff Schaller Feb 9 '17 at 0:47
  • There is no other export. And it is NFS v4. – chris01 Feb 9 '17 at 9:59
  • 1
    Check out section Using exportfs with NFSv4 in this guide. – meuh Feb 11 '17 at 14:52
1

This is normal for NFS 4 unless you specify a top-level root with option fsid=0

/home/max/shared 192.168.10.0/24(rw,sync,subtree_check,fsid=0)

may help

Or you could limit it to /home

/home 192.168.10.0/24(ro,sync,subtree_check,fsid=0)
/home/max/shared 192.168.10.0/24(rw,sync,subtree_check)

Though the problem is there that other /home/username directories will still be accessible at least read-only, so see below for what people do to really limit what is exported:

What people seem to do is create a new top-level directory , export it with fsid=0, and then use bind mounts to mount all their exports under that

eg

 mkdir -p /nfs/home/max/shared
 mount -o bind /home/max/shared /nfs/home/max/shared

And then export /nfs with fsid=0

1
  • Added a note that with the first simple method, other home directories would still be exported too – Chunko Feb 13 '17 at 22:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.