且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

NFS配置选项

更新时间:2022-09-15 20:11:55

rw 读写
ro 只读
sync 同步模式,内存数据实时写入磁盘
async 非同步模式
no_root_squash 客户端挂载NFS共享目录后,root用户不受约束,权限很大
(就像在自己家目录下,通常不限制root)
root_squash 与上面选项相对,客户端上的root用户收到约束,被限定成某个普通用户
all_squash 客户端上所有用户在使用NFS共享目录时都被限定为一个普通用户
anonuid/anongid 和上面几个选项搭配使用,定义被限定用户的uid和gid
创建文件,按设置的uid/gid为准(未设置默认为uid=65534(nfsnobody) 设置了但是没有用户会显示uid、gid)

客户端挂载
yum install -y nfs-utils
systemctl enable rpcbind 
客户端挂载问题!需要关闭服务端和客户端防火墙以及selinux。
[root@lsx03 ~]# showmount -e 192.168.1.12 //测试有没有挂载的权限
clnt_create: RPC: Port mapper failure - Unable to receive: errno 111 (Connection refused)

第一种:先启动rpc服务,在启动nfs服务
服务器端开启防火墙或者做了设置。出现这种情况。
排查方式:可以客户端telnet 服务端 111端口不通
服务端showmount自己通的话配置没问题

[root@lsx03 ~]# showmount -e 192.168.1.12 //ip是服务器ip
Export list for 192.168.1.12:
/home/nfstestdir 192.168.211.131/24

mount -t nfs 192.168.133.130:/home/nfstestdir /mnt //是服务器:/home/nfstestdir挂载到本地
df -h
touch /mnt/aminglinux.txt
ls -l /mnt/aminglinux.txt //可以看到文件的属主和属组都为1000



本文转自 虾米的春天 51CTO博客,原文链接:http://blog.51cto.com/lsxme/2061906,如需转载请自行联系原作者