Nfs – nobody user/group with NIS/NFS

nfsnisnobodypermissionsyp

Software overview

Machine A(NIS server): CentOS 6.2

Machine B:(NFS server) CentoS 6.2

Client machines: OpenSuse 12.3, CentOS 6.4 and CentOS 5.6

Introduction and setup

Machine A is an NIS server which serves a group of client machines. Home directories, as defined by the NIS mapping, come from an NFS server (machine B) are mounted automatically on login.

Machine B is an NFS server which authenticates using NIS.

When I log in to a client machine I can read/write to my home directory and all files therein are

alex users

in terms of permission. The same is true when I log into the NFS server.

HOWEVER when I log into the NIS server, my home directory mounts, I can write files to it, but all files appear as

nobody nobody

for permission. Despite this whoami yeilds alex

Test: Creating files on the NIS server in the /home/alex directory

If I create a file in my home directory while logged in to the NIS server

touch /home/alex/testfile 
ls -l testfile # on server

-rw-r--r--. 1 nobody nobody 0 Mar 19 14:21 testfile

but if I run ls -l on a client machine I get

ls -l testfile # on client machine
-rw-r--r--. 1 alex users 0 Mar 19 14:21 testfile

So clearly the file is being created as the correct user and permissions are being respected on the NIS server. Other than displaying my files as nobody nobody everything appears fine, but I'm worried this may be a symptom of something more serious.

Test: ypcat commands

When logged in to the NIS server I can run

ypcat passwd

and get output.

However ypcat shadow yields

 No such map shadow. Reason: Internal NIS error

But I would have thought this was because I have

MERGE_PASSWD=true

Set in my /var/yp/Makefile

Unwanted password redundancy

As a final weird twist – for some users, they're able to log in via NIS using old passwords which should no longer work. I have no idea how this would happen because there's only a single entry per user in the /etc/passwd and /etc/shadow? This may be an unrelated issue, or may provide useful information.

Best Answer

I guess that you are mounting nfsv3 on client machines and nfsv4 on Machine B (nis server)

If you are using autofs to mount home directories add the -nfsvers=3 option at Machine B