Unable to write as root (but can as user)

14,768

This is usually caused by the configuration on the NFS server. NFS servers will often map UID 0 (root) to another user such as "nobody" or "nfsnobody". You need to specify on the NFS server which clients are allowed root access to the mount. On Linux, you usually need to specify no_root_squash in the /etc/exports file where the export is defined.

For example:

/data1/home        <mynfsclient.ip.or.dnsname>(rw,no_root_squash)

or

/data1/home       rw,no_root_squash

After this is set up, unmount and remount the export on the client and you should be able to access it as root.

Share:
14,768

Related videos on Youtube

Alex
Author by

Alex

Updated on September 18, 2022

Comments

  • Alex
    Alex almost 2 years

    I have an NFS/NIS based file system. NFS and NIS servers are on different physical machines. When we log into our head node home directories are automounted. When logged in as a user I can write changes in my home directory. However, when I su root and try and write to my home directory I get a permission denied error.

    Any ideas? Directories are mounted as rw (from the output of mount)

    10.1.1.11:/data1/home/alex on /home/alex type nfs (rw,addr=10.1.1.11)
    

    On the NFS server the /etc/exports defines the mounted /home directory (which contains each users home directory) as rw. I have a feeling I remember reading about you can set a flag so mounted NFS directories cannot be written to as a root?

  • Alex
    Alex about 11 years
    Hmmm - do I need to do anything else other than update the /etc/export file? I've done that, logged out and logged back in (which autodismounts/automounts) the client, and still nothing. However, I'm sure this is the right track - thanks.
  • Isaac Freeman
    Isaac Freeman about 11 years
    Double check that it was actually unmounted. Autofs will usually keep things mounted for 10-15 minutes after you log out. You could cd out of your home, manually unmount it, restart autofs/automount, then log in again to be sure. The only other thing I can think of might be the mount options on the client if there are options that aren't listed in the mount command output.
  • Alex
    Alex about 11 years
    I can't confirm this, because if I unmounted everything I'll kill a massive number of jobs being run on our cluster, but I'm sure you're right. Even when I log out, other directories inside the parent directory stay mounted, so I bet that's the issue. Thanks.