[root@test home]# ps -ef | egrep "rpc|nfs" root 487 2 0 Mar21 ? 00:00:00 [rpciod] rpc 65293 1 0 Mar21 ? 00:00:00 /sbin/rpcbind -w rpcuser 76183 1 0 Mar21 ? 00:00:00 /usr/sbin/rpc.statd --no-notify root 152992 567813 0 18:43 pts/0 00:00:00 grep -E --color=auto rpc|nfs root 757265 1 0 17:08 ? 00:00:00 /usr/sbin/rpc.idmapd root 757267 1 0 17:08 ? 00:00:00 /usr/sbin/rpc.mountd root 757272 2 0 17:08 ? 00:00:00 [nfsd4_callbacks] root 757278 2 0 17:08 ? 00:00:00 [nfsd] root 757279 2 0 17:08 ? 00:00:00 [nfsd] root 757280 2 0 17:08 ? 00:00:00 [nfsd] root 757281 2 0 17:08 ? 00:00:00 [nfsd] root 757282 2 0 17:08 ? 00:00:00 [nfsd] root 757283 2 0 17:08 ? 00:00:00 [nfsd] root 757284 2 0 17:08 ? 00:00:00 [nfsd] root 757285 2 0 17:08 ? 00:00:00 [nfsd]
参数命令
|
参数做用
|
rw
|
可读写
|
ro
|
只读权限
|
sync
|
请求或写入数据时,数据会同步写入到服务端硬盘,再返回
|
no_root_squas
|
对于客户端用户 root 不压缩。即客户端 root 能够以 root 身份来访问文件
|
root_squash
|
对客户端用户 root 压缩,将 root 身份压缩为 nobody
|
all_squash
|
对客户端所用用户压缩,默认将用户身份压缩为用户 nobody 和用户组 nobody。
可指定压缩用户的身份,可是须要客户端和服务端都有该用户,不然没法访问
|
anonuid
|
匿名的 uid,说明客户端以什么用户来访问服务端文件系统
|
anongid
|
匿名的 gid,说明客户端以什么用户组来访问服务端文件系统
|
[root@test home]# rpm -qa | egrep "rpc|nfs" libnfsidmap-0.25-15.el7.x86_64 rpcbind-0.2.0-38.el7.x86_64 libtirpc-0.2.4-0.8.el7.x86_64 nfs-utils-1.3.0-0.33.el7.x86_64 xmlrpc-c-1.32.5-1905.svn2451.el7.x86_64 xmlrpc-c-client-1.32.5-1905.svn2451.el7.x86_64
[root@test home]# systemctl start rpcbind [root@test home]# systemctl start nfs [root@test test]# rpcinfo -p localhost program vers proto port service 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100000 4 udp 111 portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 55860 status 100024 1 tcp 49019 status 100005 1 udp 20048 mountd 100005 1 tcp 20048 mountd 100005 2 udp 20048 mountd 100005 2 tcp 20048 mountd 100005 3 udp 20048 mountd 100005 3 tcp 20048 mountd 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100227 3 tcp 2049 nfs_acl 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100227 3 udp 2049 nfs_acl 100021 1 udp 36125 nlockmgr 100021 3 udp 36125 nlockmgr 100021 4 udp 36125 nlockmgr 100021 1 tcp 42363 nlockmgr 100021 3 tcp 42363 nlockmgr 100021 4 tcp 42363 nlockmgr
[root@test test]# cat /etc/passwd | grep 4300 [root@test test]# cat /etc/group | grep 4300 [root@test test]# groupadd -g 4300 lianhuasheng [root@test test]# useradd -u 4300 -g 4300 lianhuasheng [root@test test]# cat /etc/passwd | grep lianhuasheng lianhuasheng:x:4300:4300::/home/lianhuasheng:/bin/bash [root@test home]# cat /etc/exports | grep 4300 /home/test 10.57.0.0/24(rw,sync,all_squash,anonuid=4300,anongid=4300) [root@test home]# systemctl restart nfs
[root@test test]# cat /etc/passwd | grep 4300 [root@test test]# cat /etc/group | grep 4300 [root@test test]# groupadd -g 4300 lianhuasheng [root@test test]# useradd -u 4300 -g 4300 lianhuasheng [root@test test]# cat /etc/passwd | grep lianhuasheng lianhuasheng:x:4300:4300::/home/lianhuasheng:/bin/bash
[root@test test]# systemctl stop iptables
[root@test lianhuasheng]# showmount -e 10.57.0.1 Export list for 10.57.0.1: /home/test 10.57.0.0/24 [root@test test]# mount -t nfs 10.57.0.1:/home/test /home/test/lianhuasheng/ [root@test home]# df -hT | grep lianhuasheng 10.57.0.1:/home/test nfs4 895G 849G 46G 95% /home/test/lianhuasheng
[root@test lianhuasheng]# touch nfs.log [root@test lianhuasheng]# ll total 0 -rw-r--r--. 1 lianhuasheng lianhuasheng 0 Mar 22 17:10 nfs.log
[root@test test]# ll -h total 0 -rw-r--r--. 1 lianhuasheng lianhuasheng 0 Mar 22 17:10 nfs.log
[root@test lianhuasheng]# lsof /home/test/lianhuasheng/ COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME lsof 407987 root cwd DIR 0,549 21 1325440613 /home/test/lianhuasheng (10.57.0.1:/home/test) lsof 407988 root cwd DIR 0,549 21 1325440613 /home/test/lianhuasheng (10.57.0.1:/home/test) bash 682732 root cwd DIR 0,549 21 1325440613 /home/test/lianhuasheng (10.57.0.1:/home/test)