Ubuntu: File permissions on NFS mount show up as 'nobody' after upgrading to 14.04



Question:

I have an Ubuntu 12.04 server that exports a couple of filesystems over NFS.

server$ cat /etc/exports  /home 192.168.42.0/255.255.255.0(rw,anonuid=65534,anongid=65534,async,no_subtree_check)  /stuff 192.168.42.0/255.255.255.0(rw,anonuid=65534,anongid=65534,async,no_subtree_check)  /stuff 192.168.99.0/255.255.255.0(ro,anonuid=65534,anongid=65534,async,no_subtree_check)  

I also have a client that mounts them:

client$ cat /etc/fstab  ...  server:/home    /home       nfs hard,intr,rsize=8192,wsize=8192,_netdev 0 0  server:/stuff   /server/stuff   nfs hard,intr,rsize=8192,wsize=8192,_netdev 0 0  

The client's IP is in the 192.168.42.x range. It was running Ubuntu 10.04 until yesterday. NFS worked fine, more or less (sometimes it wouldn't automount on boot, but I had a cron script to detect and fix that).

I upgraded the client to Ubuntu 12.04 yesterday and rebooted. NFS continued to work fine.

I upgraded the client to Ubuntu 14.04 today and rebooted. Now NFS is mounted but all file ownership information is mapped to nobody:4294967294:

client$ ls -ld /home/weblate  drwxr-xr-x   5 nobody 4294967294     4096 Jan 29  2014 weblate  

Why is that and what do I need to do to make file ownership work again?


Solution:1

The vital clue showed up in /var/log/syslog:

Sep 16 13:11:07 client nfsidmap[7340]: nss_getpwnam: name 'www-data@lan' does not map into domain 'localdomain'  

combined with this excerpt from NFSv4Howto

If all directory listings show just "nobody" and "nogroup" instead of real user and group names, then you might want to check the Domain parameter set in /etc/idmapd.conf. NFSv4 client and server should be in the same domain.

and this comment in /etc/idmap.conf:

# set your own domain here, if id differs from FQDN minus hostname  # Domain = localdomain  

So turns out my server thought its domain was lan:

server$ hostname -f  server.lan    server$ grep server /etc/hosts  127.0.1.1   server.lan server  

while my client didn't have a domain:

client$ hostname -f  client    client$ grep client /etc/hosts  127.0.1.1   client  

The fix: edit /etc/hosts on the client to read

127.0.1.1   client.lan client  

and reboot.


Solution:2

I resolved my issue by this method. Open the file /etc/nfsmount.conf and find Nfsvers=.

Uncomment that line and write the NFS version which is supported by your server. Mine was 3 so I wrote:

Nfsvers=3  

The I restarted the NFS server.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »