NFS Server Implementing file Sharing
An experimental requirement
1 familiar with the creation of/etc/exports
2 Mastering the methods of activating service Portmap and NFS
3 Mastering client and server-side settings
4 Familiar with showmount function
5 Mastering the Use of NFS for file sharing visits between two Linux computers
Two experimental contents and steps
(i) NFS server-side settings
( 1 ) using VI Edit /etc/exports file, if the file does not exist, establish itself.
Fill in the content:
directory host name to be shared or IP Address 1 (parameter 1, parameter 2) host 2 (Parameter ... .. )
The parameters are the permission settings of the corresponding host, usually:
RW: Readable and writable
RO: Read-only
No_root_squash:root the client is still rooted after login, generally unsafe.
Root_squash:root when a customer logs on, it becomes an anonymous user.
Sync: Data synchronously written to memory and hard disk
Async: Data is stored in memory rather than directly to the hard disk.
For example: In the desktop new folder named NewShare, create a file File1,file2 in this folder, create a folder Dir1,dir2.
Share the NewShare.
Command:
Vi/etc/exports
/root/desktop/newshare 10.212.22.* (Rw,no_root_squash,sync)
10.212.22.* said that all IP in the restricted network can be accessed, or specify an IP address, which can only be accessed by the machine.
( 2 ) Activation Portmap,nfs Service
These two services are already active in the general system and can be reactivated once, to be sure.
Command:
Service Portmap Restart
Service NFS Restart
( 3 ) /etc/exports after modification, the new load
Command
EXPORTFS-RV// re-export the file system
( 4 ) Inspection Catalogue /var/lib/nfs/xtab
This file records all the shared directory information. If not, it is established.
Also use VI to create.
Command:
Vi/var/lib/nfs/xtab
/root/desktop/newshare 10.212.22.* (Rw,no_root_squash,sync)
( 5 ) Last available Showmount View the shared directory on this computer
Command
showmount-e This machine IP or server machine IP
(ii) client-side settings
( 1 ) using Showmount View shared directories on the server
Command:
showmount-e Server host name or IP Address
( 2 ) to establish a local mount point on the client
Suppose you want to attach the host content to the share directory on the client desktop. Create a new share directory on the client desktop.
Command:
mkdir Share
mount-t NFS [email protected]@@ ( here is the hostname or IP of the server ) : /root/desktop/newshare/root/desktop/share
This mounts the NewShare directory on the server to the local share directory and has read and write operations.
( 3 ) using Umount Uninstalling a mounted NFS Catalogue
For example, to uninstall a directory that has just been mounted
Umount/root/desktop/share
The content in the local directory and the host are disconnected.
( 4 Note that the server firewall is turned off when mounted.
"Desktop"-"Manage"-"security: ", turn off the firewall.
NFS Server for file sharing