NFS = = Network File system, which implements read and write files through network communication
Need to have a server-side and client-side communication form, the machine can access the remote machine files
There is a B C three machines, on a To do an NFS, so that B and C can access to synchronize the sharing of files
Steps:
Service-Side IP 192.168.174.128
Download Yum install-y nfs-utils rpcbind (Rpcbind used for communication between client and server side)
Vim/etc/exports
Write/mnt 192.168.174.129 (rw,sync): Mount the file system to the/MNT directory, making the client machine readable and writable
Start Rpcbind and NFS:
/etc/init.d/rpcbind start
/etc/init.d/nfs start
Go to the client:
Download installation Nfs:yum Install Nfs-utils
SHOWMOUNT-E 192.168.174.128
Mount the directory shared by the server to the client's/OPT directory: mount-t NFS 192.168.174.128:/mnt/opt
It means that if I want to read and write to the shared directory, then the remote directory must be used as part of this machine, the user can directly contact; After the mount, you can also see the NFS directory df-h, and the file system type is NFS; Files created in the shared directory are mapped by the owner and the group is nfsnobody, but can also go to the free to specify the mappings of the owner and the group
Go to the service side:
Change the permissions of the/MNT directory to 777
Go to the client:
You can create a file under/opt, with no restrictions on permissions
[[email protected] opt]# Touch 1.txt
Service side:
Specify both user and group for all users to be 501:
/mnt 192.168.174.129 (rw,sync,all_squash,anonuid=501,anongid=501)
Two ways to restart:
/etc/init.d/nfs restart
Exportfs-arv
Do not restrict the root user to the client:
The client creates the file as root, so the user and group of the file should also be root; Not to limit root
/mnt 192.168.174.129 (Rw,sync,no_root_squash)
Client:
Uninstall First: umount/opt
To mount again, you need to specify that the NFS version is 3:mount-t nfs-onolock,nfsvers=3 192.168.174.128:/mnt/opt
If the NFS version is 4, the user is mapped to the Nfsnobody
This article is from the "Parody Games" blog, so be sure to keep this source http://kevinjin117.blog.51cto.com/11655131/1843598
NFS Service configuration under Linux