[root@nfs ~]# useradd nfSUSEr -s /sbin/nologin
[root@nfs ~]# id nfsuser
uid=1003(nfsuser) gid=1003(nfsuser) groups=1003(nfsuser)
[root@nfs ~]# chown -R nfsuser:nfsuser /nfs_dir/
[root@nfs ~]# vim /etc/exports
[root@nfs ~]# cat /etc/exports
/nfs_dir 192.168.4.*(rw,sync,all_squash,anonuid=1003,anongid=1003)
[root@nfs ~]# exportfs -rv
exporting 192.168.4.*:/nfs_dir
客户端进行测试:
[root@client mnt]# touch file
[root@client mnt]# ll
total 4
-rw-r--r--. 1 1003 1003 0 Jun 28 14:27 file
-rw-r--r--. 1 1003 1003 23 Jun 28 11:08 welcome
[root@client mnt]# echo 123 > file
[root@client mnt]# cat welcome
This is NFS test file.
[root@client mnt]# rm file
rm: remove regular file ‘file’? y
[root@client mnt]# ll
total 4
-rw-r--r--. 1 1003 1003 23 Jun 28 11:08 welcome
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx