According to the manpage for the exports file the options available to manage how exports and sub-exports interact are crossmnt, nohide and hide.
I have three servers A, B and C where A is the nfs server and B and C are clients. The exports file on A looks like this:
/export -no_subtree_check,fsid=0,sec=sys B C /export/sub1 -no_subtree_check,sec=sys B /export/sub2 -no_subtree_check,sec=sys C
All directories on the server belong to local root and the mounting and interaction with the mount on the client is also done with local root. Mounting is done with the following command
mount -t nfs4 A:/ /mnt/A
If /export is mounted on either B or C the client can see into both sub directories, even though neither crossmnt nor nohide have been specified. Even if i add hide to the sub exports the behavior is still the same. Is there a way to achieve the behavior described in the manpage of the exports file?
nohide export options on the NFS server operate on filesystem mounts, not merely subdirectories. Thus it would work if
/export/sub1 etc. were different filesystems, but you indicated that they are on the same filesystem. In this case you need to rearrange your directory structure so that subdirectories not meant to be mounted by all clients are simply not there. For example:
/export/sub0 -no_subtree_check,sec=sys B C /export/sub1 -no_subtree_check,sec=sys B /export/sub2 -no_subtree_check,sec=sys C
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.