我有一个由ftp:users拥有的文件夹。 我想导出这个文件夹,并将所有的请求映射到ftp用户,其ID为107.在/etc/exports我有以下内容:
/media/other 10.1.1.10(rw,sync,all_squash,no_subtree_check,anonuid=107)
这按预期工作。 在客户端,我想映射这些匿名请求到不同的用户,所以在/etc/idmapd.conf我有这样的:
Nobody-User = nfsanon Nobody-Group = nfsanon
但是,当挂载NFSv4时,所有内容都由nobody:users 。 它正确地映射了组(它也存在于客户端上),但是客户端上不存在的ftp用户映射到idmapd.conf nobody而不是Nobody-User 。
为了试图理解为什么会发生这种情况,我打开了详细信息,并将其插入客户端日志中 。 一次安装尝试产生以下内容:
nfsidmap[8610]: key: 0x28bf0a94 type: uid value: [email protected] timeout 600 nfsidmap[8610]: nfs4_name_to_uid: calling nsswitch->name_to_uid nfsidmap[8610]: nss_getpwnam: name '[email protected]' domain 'dom.ain': resulting localname 'root' nfsidmap[8610]: nfs4_name_to_uid: nsswitch->name_to_uid returned 0 nfsidmap[8610]: nfs4_name_to_uid: final return value is 0 nfsidmap[8612]: key: 0xfe99b5c type: gid value: [email protected] timeout 600 nfsidmap[8612]: nfs4_name_to_gid: calling nsswitch->name_to_gid nfsidmap[8612]: nfs4_name_to_gid: nsswitch->name_to_gid returned 0 nfsidmap[8612]: nfs4_name_to_gid: final return value is 0 nfsidmap[8615]: key: 0x18a11cb type: uid value: [email protected] timeout 600 nfsidmap[8615]: nfs4_name_to_uid: calling nsswitch->name_to_uid nfsidmap[8615]: nss_getpwnam: name '[email protected]' domain 'dom.ain': resulting localname 'ftp' nfsidmap[8615]: nss_getpwnam: name 'ftp' not found in domain 'dom.ain' nfsidmap[8615]: nfs4_name_to_uid: nsswitch->name_to_uid returned -2 nfsidmap[8615]: nfs4_name_to_uid: final return value is -2 nfsidmap[8615]: nfs4_name_to_uid: calling nsswitch->name_to_uid nfsidmap[8615]: nss_getpwnam: name '[email protected]' domain 'dom.ain': resulting localname 'nobody' nfsidmap[8615]: nfs4_name_to_uid: nsswitch->name_to_uid returned 0 nfsidmap[8615]: nfs4_name_to_uid: final return value is 0 nfsidmap[8617]: key: 0x3ab07a1f type: gid value: [email protected] timeout 600 nfsidmap[8617]: nfs4_name_to_gid: calling nsswitch->name_to_gid nfsidmap[8617]: nfs4_name_to_gid: nsswitch->name_to_gid returned 0 nfsidmap[8617]: nfs4_name_to_gid: final return value is 0
所以看起来客户端idmapd试图映射ftp用户,这失败了。
nss_getpwnam: name '[email protected]' domain 'dom.ain': resulting localname 'ftp' nss_getpwnam: name 'ftp' not found in domain 'dom.ain' nfs4_name_to_uid: nsswitch->name_to_uid returned -2
然后它实际上试图映射nobody而不是使用Nobody-User 。 由于nobody用户存在于客户端,所以成功了。
nss_getpwnam: name '[email protected]' domain 'dom.ain': resulting localname 'nobody' nfs4_name_to_uid: nsswitch->name_to_uid returned 0
我只是不知道为什么它试图映射nobody 。 这可能是在出口中使用anonuid触发的错误吗?
为了完整起见,这里是服务器日志
rpc.idmapd[4726]: nfsdcb: authbuf=10.1.1.0/24,10.1.1.0/25,10.1.1.10 authtype=user rpc.idmapd[4726]: nfs4_uid_to_name: calling nsswitch->uid_to_name rpc.idmapd[4726]: nfs4_uid_to_name: nsswitch->uid_to_name returned 0 rpc.idmapd[4726]: nfs4_uid_to_name: final return value is 0 rpc.idmapd[4726]: Server : (user) id "0" -> name "[email protected]" rpc.idmapd[4726]: nfsdcb: authbuf=10.1.1.0/24,10.1.1.0/25,10.1.1.10 authtype=group rpc.idmapd[4726]: nfs4_gid_to_name: calling nsswitch->gid_to_name rpc.idmapd[4726]: nfs4_gid_to_name: nsswitch->gid_to_name returned 0 rpc.idmapd[4726]: nfs4_gid_to_name: final return value is 0 rpc.idmapd[4726]: Server : (group) id "0" -> name "[email protected]" rpc.idmapd[4726]: nfsdcb: authbuf=10.1.1.0/24,10.1.1.0/25,10.1.1.10 authtype=user rpc.idmapd[4726]: nfs4_uid_to_name: calling nsswitch->uid_to_name rpc.idmapd[4726]: nfs4_uid_to_name: nsswitch->uid_to_name returned 0 rpc.idmapd[4726]: nfs4_uid_to_name: final return value is 0 rpc.idmapd[4726]: Server : (user) id "107" -> name "[email protected]" rpc.idmapd[4726]: nfsdcb: authbuf=10.1.1.0/24,10.1.1.0/25,10.1.1.10 authtype=group rpc.idmapd[4726]: nfs4_gid_to_name: calling nsswitch->gid_to_name rpc.idmapd[4726]: nfs4_gid_to_name: nsswitch->gid_to_name returned 0 rpc.idmapd[4726]: nfs4_gid_to_name: final return value is 0 rpc.idmapd[4726]: Server : (group) id "100" -> name "[email protected]"
PS:之前有人build议,我不希望切换回NFSv3“解决”我的问题。