CentOS6.x的NFS配置跟CentOS5.x不太一样,不光是安装包及服务名变了,还总有各种古怪的事情,今天遇到了NFS客户端mount NFS之后目录的属主变成了nobody:nobody,折腾了半天,终于找到了解决办法:
本次案例:
OS: CentOS-6.5
NFS Server: 192.168.100.101 nfsserver.sudops.com
NFS Client: 192.168.100.102 nfsclient.sudops.com
服务端配置:
# cat /etc/exports
/data/storage 192.168.100.0/255.255.255.0(rw,sync,all_squash,anonuid=0,anongid=0)
# cat /etc/idmapd.conf
[General]
#Verbosity = 0
# The following should be set to the local NFSv4 domain name
# The default is the host's DNS domain name.
#Domain = local.domain.edu
1
2
3
4
5
6
7
8
9
# cat /etc/exports
/data/storage192.168.100.0/255.255.255.0(rw,sync,all_squash,anonuid=0,anongid=0)
# cat /etc/idmapd.conf
[General]
#Verbosity = 0
# The following should be set to the local NFSv4 domain name
# The default is the host's DNS domain name.
#Domain = local.domain.edu
改成
[General]
#Verbosity = 0
# The following should be set to the local NFSv4 domain name
# The default is the host's DNS domain name.
#Domain = local.domain.edu
Domain = sudops.com
1
2
3
4
5
6
[General]
#Verbosity = 0
# The following should be set to the local NFSv4 domain name
# The default is the host's DNS domain name.
#Domain = local.domain.edu
Domain=sudops.com
重启NFS服务端
# /etc/init.d/nfs restart
# /etc/init.d/rpcbind restart
# /etc/init.d/rpcidmapd restart
1
2
3
# /etc/init.d/nfs restart
# /etc/init.d/rpcbind restart
# /etc/init.d/rpcidmapd restart
客户端配置:
跟服务端一样也要修改/etc/idmapd.conf
重启客户端应用
# /etc/init.d/rpcbind restart
# /etc/init.d/rpcidmapd restart
1
2
# /etc/init.d/rpcbind restart
# /etc/init.d/rpcidmapd restart
重新mount
# umount -l /local/storage
# mount -t nfs 192.168.100.101:/data/storage/ /local/storage
1
2
# umount -l /local/storage
# mount -t nfs 192.168.100.101:/data/storage/ /local/storage
这次终于跟NFS的export目录属主保持一致啦!
本文介绍了解决CentOS 6.x NFS客户端挂载目录后,属主变为nobody的问题。通过调整服务端与客户端的配置文件,并重启相关服务,最终实现NFS共享目录与本地目录权限的一致。
3188

被折叠的 条评论
为什么被折叠?



