[CentOS] nfs4 and idmapd

Peter Wood

peterwood.sd at gmail.com
Tue Apr 16 18:39:22 UTC 2013


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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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



More information about the CentOS mailing list