Search code examples
linuxubuntunfs

NFS different permissions to subdirectories


I have the following /etc/exports config for my NFS server.

/root/share *(rw,fsid=0,no_root_squash)
/root/share/music anne(rw,no_root_squash) alex(rw,no_root_squash)
/root/share/video anne(rw,no_root_squash) alex(ro,no_root_squash)

I want anne to have rw access to both directories. I want alex to have only ro access to /root/share/video. The problem with my current config is that they both have rw access.

If I change the first line to

/root/share *(ro,fsid=0,no_root_squash)

It overwrites every other line and makes all directories read-only.

How can I make the first line take effect only on /root/share ?

Thank you.


Solution

  • You are very confused about what constitutes an exported filesystem. /etc/exports does not contain an Access Control List - not really. It contains a list of independent filesystems and how they should be exported.

    Each entry is completely separate from each other and the export name matching is exact, not recursive - if alex mounts /root/share only the first entry will be used. In the same vein, alex cannot mount /root/share/misc directly because it is not an exported directory.