Nfs4 And Idmapd

Home » CentOS » Nfs4 And Idmapd
CentOS 1 Comment

I’m using CentOS5.9 and mounting a remote directory via NFSv4. The nfs server is OpenIndiana 151.a.7 (i.e. Solaris).

Users bin and daemon have each others ID on the oposite system.

On OpenIndiana:
User: bin; ID=2
User: daemon; ID=1

On CentOS:
User: bin; ID=1
User: daemon; ID=2

That means if I create a file as daemon on the client (CentOS), it gets saved on the server as owner bin and it shows back on the client as owner bin.

I’m trying to use idmapd to define custom mapping but I can’t get it working.

======cat /etc/idmapd.conf
[General]
Verbosity = 5
Domain = local

[Mapping]
Nobody-User = nobody
Nobody-Group = nobody

[Translation]
Method = static,nsswitch

[Static]
bin@local = daemon

======service rpcidmapd restart In /var/log/messages:
Apr 16 11:26:37 tzalt rpc.idmapd[29848]: libnfsidmap: using domain: local
Apr 16 11:26:37 tzalt rpc.idmapd[29848]: libnfsidmap: processing ‘Method’
list
Apr 16 11:26:37 tzalt rpc.idmapd[29848]: libnfsidmap: loaded plugin libnfsidmap_static.so for method static
Apr 16 11:26:37 tzalt rpc.idmapd[29848]: libnfsidmap: loaded plugin libnfsidmap_nsswitch.so for method nsswitch
Apr 16 11:26:37 tzalt rpc.idmapd[29849]: Expiration time is 600 seconds.
Apr 16 11:26:37 tzalt rpc.idmapd[29849]: nfsdopenone: Opening
/proc/net/rpc/nfs4.nametoid/channel failed: errno 2 (No such file or directory)

I researched the error above and in a few places people say that it should be ignored.

=====mount -t nfs4 srvstor15:/utils/depdata /utils/depdata In /var/log/messages:
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: New client: 4b Apr 16 11:28:42 tzalt rpc.idmapd[29849]: Opened
/var/lib/nfs/rpc_pipefs//nfs/clnt4b/idmap Apr 16 11:28:42 tzalt rpc.idmapd[29849]: New client: 4c Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_uid: calling nsswitch->name_to_uid Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nss_getpwnam: name ‘root@local’
domain ‘local’: resulting localname ‘root’
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_uid:
nsswitch->name_to_uid returned 0
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_uid: final return value is 0
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: Client 4b: (user) name “root@local”
-> id “0”
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_gid: calling nsswitch->name_to_gid Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_gid:
nsswitch->name_to_gid returned -2
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_gid: final return value is -2
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: Client 4b: (group) name
“staff@local” -> id “99”
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_gid: calling nsswitch->name_to_gid Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_gid:
nsswitch->name_to_gid returned 0
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_gid: final return value is 0
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: Client 4b: (group) name “root@local”
-> id “0”
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_uid: calling nsswitch->name_to_uid Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nss_getpwnam: name ‘daemon@local’
domain ‘local’: resulting localname ‘daemon’
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_uid:
nsswitch->name_to_uid returned 0
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_uid: final return value is 0
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: Client 4b: (user) name
“daemon@local” -> id “2”
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_gid: calling nsswitch->name_to_gid Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_gid:
nsswitch->name_to_gid returned 0
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: nfs4_name_to_gid: final return value is 0
Apr 16 11:28:42 tzalt rpc.idmapd[29849]: Client 4b: (group) name
“daemon@local” -> id “2”

=====sudo -u daemon touch /utils/depdata/bin/asdfDaemonF1
In /var/log/messages:
Apr 16 11:31:56 tzalt rpc.idmapd[29849]: nfs4_name_to_uid: calling nsswitch->name_to_uid Apr 16 11:31:56 tzalt rpc.idmapd[29849]: nss_getpwnam: name ‘bin@local’
domain ‘local’: resulting localname ‘bin’
Apr 16 11:31:56 tzalt rpc.idmapd[29849]: nfs4_name_to_uid:
nsswitch->name_to_uid returned 0
Apr 16 11:31:56 tzalt rpc.idmapd[29849]: nfs4_name_to_uid: final return value is 0
Apr 16 11:31:56 tzalt rpc.idmapd[29849]: Client 4b: (user) name “bin@local”
-> id “1”
Apr 16 11:31:56 tzalt rpc.idmapd[29849]: nfs4_name_to_gid: calling nsswitch->name_to_gid Apr 16 11:31:56 tzalt rpc.idmapd[29849]: nfs4_name_to_gid:
nsswitch->name_to_gid returned 0
Apr 16 11:31:56 tzalt rpc.idmapd[29849]: nfs4_name_to_gid: final return value is 0
Apr 16 11:31:56 tzalt rpc.idmapd[29849]: Client 4b: (group) name “bin@local”
-> id “1”

=====ls -l /utils/depdata/bin/asdfDaemonF1
-rw-r–r– 1 bin bin 0 Apr 16 11:31 /utils/depdata/bin/asdfDaemonF1

The file is owned by user bin on the client and the server. But, I used user daemon to create it.

Any suggestion how can I get this ownership in sync?

Thanks,

— Peter

One thought on - Nfs4 And Idmapd

  • Peter Wood wrote:

    don’t know for idmapd, but if you have a simple setup you could switch the uids of bin and daemon on your client (and chown all their files of course).

LEAVE A COMMENT