我们有3台服务器:
- NFS 服务器:1.2.3.4 (rhel 6.8)
- 一个不错的NFS客户端:SERVER5G(rhel6.8)
- 错误的 NFS 客户端:SERVER6B (rhel6.3)
SERVER6B(不良 nfs 客户端)的问题在于,它将相同 NFS 挂载的用户/组显示为“nobody”。
NFSv4、RHEL 6 计算机。
[root@SERVER5G ~]# ls -la /var/FOODump/
total 55205372
drwxrwxr-x 18 foouser root 4096 Jul 11 17:40 .
drwxr-xr-x. 31 root root 4096 Mar 18 12:51 ..
-rw------- 1 foouser foouser 1117958 Mar 23 10:41 bar.7z
[root@SERVER5G ~]#
[root@SERVER5G ~]# stat /var/FOODump/bar.7z
File: `/var/FOODump/bar.7z'
Size: 1117958 Blocks: 2192 IO Block: 1048576 regular file
Device: 16h/22d Inode: 16 Links: 1
Access: (0600/-rw-------) Uid: ( 2826/ foouser) Gid: ( 2826/ foouser)
Access: 2016-03-23 10:41:48.000000000 +0000
Modify: 2016-03-23 10:41:31.000000000 +0000
Change: 2016-03-23 10:41:31.000000000 +0000
[root@SERVER5G ~]#
[root@SERVER5G ~]# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
[root@SERVER5G ~]#
[root@SERVER5G ~]# id foouser
uid=2826(foouser) gid=2826(foouser) groups=2826(foouser)
[root@SERVER5G ~]#
[root@SERVER5G ~]# df -mP /var/FOODump/
Filesystem 1048576-blocks Used Available Capacity Mounted on
1.2.3.4:/var/FOODump 193524 129698 53996 71% /var/FOODump
[root@SERVER5G ~]#
[root@SERVER5G ~]# mount | grep FOODump
1.2.3.4:/var/FOODump on /var/FOODump type nfs (rw,vers=4,addr=1.2.3.4,clientaddr=1.2.3.5)
[root@SERVER5G ~]#
和坏客户:
[root@SERVER6B ~]# ls -la /var/FOODump/
total 55205372
drwxrwxr-x 18 nobody nobody 4096 Jul 11 17:40 .
drwxr-xr-x. 31 root root 4096 Jul 6 06:40 ..
-rw------- 1 nobody nobody 1117958 Mar 23 10:41 bar.7z
[root@SERVER6B ~]#
[root@SERVER6B ~]# stat /var/FOODump/bar.7z
File: `/var/FOODump/bar.7z'
Size: 1117958 Blocks: 2192 IO Block: 1048576 regular file
Device: 18h/24d Inode: 16 Links: 1
Access: (0600/-rw-------) Uid: ( 99/ nobody) Gid: ( 99/ nobody)
Access: 2016-03-23 10:41:48.000000000 +0000
Modify: 2016-03-23 10:41:31.000000000 +0000
Change: 2016-03-23 10:41:31.000000000 +0000
[root@SERVER6B ~]#
[root@SERVER6B ~]# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
[root@SERVER6B ~]#
[root@SERVER6B ~]# id foouser
uid=2826(foouser) gid=2826(foouser) groups=2826(foouser)
[root@SERVER6B ~]#
[root@SERVER6B ~]# df -mP /var/FOODump/
Filesystem 1048576-blocks Used Available Capacity Mounted on
1.2.3.4:/var/FOODump 193524 129698 53996 71% /var/FOODump
[root@SERVER6B ~]#
[root@SERVER6B ~]# mount | grep FOODump
1.2.3.4:/var/FOODump on /var/FOODump type nfs (rw,vers=4,addr=1.2.3.4,clientaddr=1.2.3.6)
[root@SERVER6B ~]#
我们已经尝试卸载、rmmod 所有 NFS 内核模块,在 SERVER6B 上挂载 /var/FOODump,但没有帮助。
如果我们在 SERVER6B 上“su - foouser”,我们可以“触摸测试文件”:
- 在 SERVER6B 上显示为无人。
- 在 SERVER5G 上显示为 foouser
问题:为什么 SERVER6B 通过 NFS 显示“nobody”用户?
答案1
[root@SERVER6B ~]# umount /var/FOODump
[root@SERVER6B ~]# nfsidmap -c
[root@SERVER6B ~]# mount /var/FOODump
解决了问题..