Allowing root Access to NFS Directories

Posted on In Linux, Network, QA, Tutorial

For local filesystems, root usually has full access (read/write) to directories/files inside of it.

But for NFS directory mounted from network, root usually has no permission to write to directories or files within the NFS directory. How to make root act similarly in an NFS directory to the behavior in local directories?

The reason that NFS directory is non-accessible to root is likely root_squash.

It assigns them the user ID for the user nfsnobody and prevents root users connected remotely from having root privileges. This prevents unauthorized alteration of files on the remote server.

To disable root_squash, set the no_root_squash option. It turns off root squashing. But it is suggested to only use this option when it is suitable and necessary.

For example, to disable root_squash for /mnt/a. The line in /etc/exports can be:

/mnt/a 10.0.0.0/16(rw,no_root_squash)

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

2 comments

  1. I don’t normally care about spelling, but in this case, I think the article would be clearer (and safer to copy/paste from) if “root_squash” were spelled correctly throughout. It appears as “root_swash” in a couple of places.

Leave a Reply

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