我一直在试验NFSv4中的用户/组ID映射(转换)。我想要实现的是基于名称的ID转换,它独立于服务器和客户端上的实际UID/GID。
许多指南和文章提到,要使ID映射工作,必须将nfs4_disable_idmapping
参数设置为客户机上的nfs
模块中的0
(又名N),以及服务器上的nfsd
模块。但是,我没有找到任何关于这个参数到底是干什么的信息或文档。
作为一个实验,我配置了NFSv4服务器和客户机(使用sec=krb5
),并故意保留这些参数的默认值(禁用映射)。我可以验证在服务器上是否禁用了映射:
$ cat /sys/module/nfsd/parameters/nfs4_disable_idmapping
Y
在客户身上:
$ cat /sys/module/nfs/parameters/nfs4_disable_idmapping
Y
我在服务器上创建了用户bob(uid=1002)
和sam(uid=1001)
,在客户机上创建了用户bob(uid=1003)
和sam(uid=1004)
。正如您所看到的,UID并不匹配,但是,仍然正确地映射了用户。bob
用户在服务器上创建的文件被视为由bob
拥有,反之亦然。
此外,如果我查看客户机上的日志:
nfsidmap[1874]: key: 0x322c739a type: uid value: bob@home.lan timeout 600
nfsidmap[1874]: nfs4_name_to_uid: calling nsswitch->name_to_uid
nfsidmap[1874]: nss_getpwnam: name 'bob@home.lan' domain 'home.lan': resulting localname 'bob'
nfsidmap[1874]: nfs4_name_to_uid: nsswitch->name_to_uid returned 0
nfsidmap[1874]: nfs4_name_to_uid: final return value is 0
在服务器上:
rpc.idmapd[1717]: nfsdcb: authbuf=gss/krb5p authtype=user
rpc.idmapd[1717]: nfs4_uid_to_name: calling nsswitch->uid_to_name
rpc.idmapd[1717]: nfs4_uid_to_name: nsswitch->uid_to_name returned 0
rpc.idmapd[1717]: nfs4_uid_to_name: final return value is 0
rpc.idmapd[1717]: Server : (user) id "1002" -> name "bob@home.lan"
他们都认为ID映射确实是“按名”而不是“按id”进行的。
所以我的问题是:如果nfs4_disable_idmapping
参数似乎对ID映射没有任何明显的影响,那么它是什么呢?
发布于 2019-04-02 19:57:25
你遇到了一个糟糕的测试案例。根据内核文档,nfs4_disable_idmapping
选项只有在使用sec=sys
时才有意义。
https://serverfault.com/questions/949642
复制相似问题