# NFSv4 not translation UID,GID between FreeBSD server and rhel63 client



## kangaroo (Oct 30, 2012)

I have a  FreeBSD 9.1RC2 server exporting an NFS v4 filesystem (a home directory actually) that I want to mount under my rhel63 nfs client.
nfsuserd is running on FreeBSD (idmapd equivalent for Linux), idmapd is running on rhel63 and both are configured with the same domain and translation of nfsswitch.
Both systems share the same users and groups in /etc/passwd and /etc/group.   Sure, there are some additional users and groups on either system, but the real users I care about are in both with the same uid and gid.  There are no duplicate entries.

On Rhel6.3, I can mount the nfs v4 share from the FreeBSD server, and it shows up as vers=4, but all the files appear as nobody:nobody, even though they are all owned by user jast7 and group "zfstest" on the FreeBSD nfs server.
Aha! That's a simple ID mapping problem, you say?  Well, it's probably an ID mapping problem, but not sure that it's so simple....  The exported directory is owned by jast7, group zfstest.  If the exported directory is set to mode 700, and user jast7 on the rhel63 client tries to write to the directory, he can write, and yet, if another user "jas" on the rhel63 client tries to write to the directory, he cannot...   Hmmm???
So I continue ... when jast7 writes on the rhel63 client, the files show up as "nobody:nobody" on the rhel63 client, but under freebsd shows up as "jast7:zfstest" as should be the case.
On the other hand, if I make the exported directory mode 707, then user "jas" on the rhel63 system can indeed write a file.   This file shows up as "jas:nobody" on the rhel63 system, and shows up as "jas:zfstest" on the FreeBSD server.

From FreeBSD passwd:


```
jast7:x:14975:1001:jas test 7:/cs/home/jast7:/bin/false
jas:x:1004:1000:Jason:/cs/home/jas:/cs/local/bin/tcsh
```

From FreeBSD group:


```
zfstest:*:1001:
tech:*:1000:tdb
```

From Linux passwd:


```
jast7:x:14975:1001:jas test 7:/cs/home/jast7:/bin/false
jas:x:1004:1000:Jason:/cs/home/jas:/cs/local/bin/tcsh
```

From Linux group:


```
zfstest:*:1001:
tech:*:1000:
```

Just to be sure, I have tried unmounting, service rpcidmapd restart on Linux, then mounting the share, and no difference..

Any ideas?

Jason.


----------



## ziyanm (Oct 31, 2012)

Can we see the server's /etc/exports and the fstab mount line on the client?


----------



## kangaroo (Oct 31, 2012)

Sure!

/etc/exports for the jast7 export on we'll call it fileserver.work.com looks like this:


```
/obj/home12/jast7 -maproot=root host.work.com
/obj/home12/jast7 -network 172.16.16.0/20 
/obj/home12/jast7 -network 172.16.32.0/20 
/obj/home12/jast7 -network 172.16.0.0/20 
V4: /
```

(note: pool1/home12 has zfs mountpoint set to /obj/home12)

On my.host.com, I'm just mounting like:


```
# mount -t nfs fileserver.work.com:/obj/home12/jast7 /mnt 
# mount | grep jast7

fileserver.work.com:/obj/home12/jas on /mnt type nfs (rw,vers=4,addr=172.16.0.5,clientaddr=172.16.21.125)
```


----------



## kangaroo (Oct 31, 2012)

Actually, as it happens, the problem was due to nsswitch.conf having host set to "files dns" and not "dns files".  I had changed this a long time ago when I was testing something, and forgot about it being there.  When I tried the mount from a totally different system, it worked, and then I realized the problem.


----------

