Allowing root Access to NFS Directories
Posted on In Linux, Network, QA, TutorialFor 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)
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.
Hi Jenny, thanks for pointing this out. We have fixed the typos.