NFS安装配置的具体说明(1)(2)
# showmount -e 192.168.102.47
Export list for 192.168.102.47:
/home/share (everyone)
5 使用mount命令即可挂栽共享资源
在客户机 192.168.102.15 上加载共享资源
# mount 192.168.102.47:/home/share /mnt
# cd /mnt
# echo '12345'> 123
即可发现对服务器共享目录可写
# umount /mnt
在客户机 192.168.102.61 上加载共享资源
# mount 192.168.102.47:/home/share /mnt
# cd /mnt
# ls
123
# touch 321
touch: cannot touch `321': Permission denied
# echo '123455' >123
-bash: 123: Permission denied
NFS安装配置进行到这里,即可发现对服务器共享目录只有读取权限,这与我们在服务器端的权限设置是相符的。是不是我们每次修改了配置文件都需要重启nfs服务呢? 这个时候我们就可以用exportfs命令重新扫描/etc/exports文件,来使改动立刻生效。比如:
# exportfs -au 卸载所有共享目录
# exportfs -rv 重新共享所有目录并输出详细信息
exportfs 命令有软件包 nfs-kernel-server 提供,详细的 exportfs 命令说明请查看:
man exportfs
中文的手册说明可以查看这里:
exportfs联机手册
当完成资源共享, 我们如何知道发布了哪些权限呢?这时我们可以查看 /var/lib/nfs/etab 文件,它是有 exportfs 命令根据 /etc/exports 生成的。
# cat /var/lib/nfs/etab
/home/share 192.168.102.15(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash, subtree_check,secure_locks,acl,mapping=identity,anonuid=65534,anongid=65534)
/home/share *(ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,subtree_check, secure_locks,acl,mapping=identity,anonuid=65534,anongid=65534)
现在我们来查看服务器上有关NFS服务器启动了哪些端口:
tonybox:/home/share# lsof -i|grep rpc
portmap 1931 daemon 3u IPv4 4289 UDP *:sunrpc
portmap 1931 daemon 4u IPv4 4290 TCP *:sunrpc (LISTEN)
rpc.statd 3206 statd 3u IPv4 7081 UDP *:1029
rpc.statd 3206 statd 6u IPv4 7072 UDP *:838
rpc.statd 3206 statd 7u IPv4 7085 TCP *:1031 (LISTEN)
rpc.mount 3483 root 6u IPv4 7934 UDP *:691
rpc.mount 3483 root 7u IPv4 7937 TCP *:694 (LISTEN)
评论暂时关闭