Saturday 19 December 2020

NFS - No Root Squash

 There are many options for NFS and I want to keep this article short but effective so I am leaving out many of the various configuration items that you could do. However there is one option that is worth mentioning, no_root_squash. By default NFS will downgrade any files created with the root permissions to the nobody user. This is a security feature that prevents privileges from being shared unless specifically requested.

If I create a file as the root user on the client on the NFS share, by default that file is owned by the nobody user.




Sometimes it is important to share files that are owned as root with the proper permissions, in these cases this can be done by simply adding the no_root_squash attribute to the /etc/exports configuration.



Adding no_root_squash

Edit the /etc/exports file:



Modify the /nfs line to:





Re-Export the exported file systems:

 root@server:/nfs# exportfs -a
Re-Mount the file system on the client:
root@client:~/# umount /shared/nfs1
 root@client:~/# mount -a

Now any file created by root should have root permissions.



Reference link:


https://bencane.com/2012/11/23/nfs-setting-up-a-basic-nfs-file-system-share/

No comments:

Post a Comment