NFS使用autofs掛接後文件屬主顯示爲nobody

問題描述

客戶端使用autofs掛接nfs的共享文件所有顯示爲nobodydom

-rwxr-xr-x 1 nobody nobody  1819 Dec 16 16:53 clear_log.sh
-rwxr-xr-x 1 nobody nobody 16549 Dec 24 11:38 deploy.sh
-rwxr-xr-x 1 nobody nobody  5393 Dec 15 14:33 disk
-rwxr-xr-x 1 nobody nobody  2908 May  7  2015 disk.sh
-rw-r--r-- 1 nobody nobody  1885 Dec 15 16:33 get_info.sh
-rw-r--r-- 1 nobody nobody    69 Jan 11 11:35 get_properties.sh
-rw-r--r-- 1 nobody nobody    98 May  5  2015 ntp.sh
-rw-r--r-- 1 nobody nobody   282 Oct  1 10:39 restart_dubbo.sh
-rwxr-xr-x 1 nobody nobody 25843 Dec 25 10:50 shenpeng.sh
-rw------- 1 nobody nobody  1498 Aug 22 10:51 variables

問題緣由

autofs掛接nfs共享文件的時候會校驗本機與服務端的rpc域名是否一直,若是域名不一致或者域名爲example.com則會使用nobody來顯示文件的全部者。rest

[root@localhost ~]# 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

注:此問題爲mount的4版本中會出現,使用3版本則無此問題。code

解決辦法

修改nfs服務端與客戶端中/etc/idmapd.conf文件中的Domain一項
注意:Domain配置的域名不能爲example.com
以sf.com爲例ci

[root@localhost ~]# 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
Domain = sf.com

修改完成後服務端重啓nfs服務,客戶端重啓autofs服務
1.服務端rpc

service rpcbind restart
service rpcidmapd restart
service nfs restart

2.客戶端get

service rpcbind restart
service rpcidmapd restart
service autofs restart

此時可正常顯示文件的全部者身份信息。域名

相關文章
相關標籤/搜索