nfs4 and all_squash

all_squash does not work when directory/share is on the same filesystem. Example:

/etc/exports:

/media/mount 192.168.0.0/24(rw,async,no_subtree_check,fsid=0)
/media/mount/folder 192.168.0.0/24(all_squash,anonuid=1000,anongid=100,rw,async,no_subtree_check)

We have to mount folder with a bind to get this working. Move folder to new location, here I’m hiding it:

mv /media/mount/folder /media/mount/.folder
mkdir /media/mount/folder

/etc/fstab:

/dev/sdb1 /media/mount ext4 defaults 0 0
/media/mount/.folder /media/mount/folder none bind 0 0

Mount and reload nfs exports:

mount /media/mount/folder
exportfs -r

Reference: http://www.spinics.net/lists/linux-nfs/msg16593.html

2 thoughts on “nfs4 and all_squash”

  1. Thank you! Been trying to figure out why all_squash wasn’t working for hours! Why isn’t this documented?!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>