There are many file sharing methods (ftp, smba, and NFS) between Linux servers. Here we will introduce the nfs file sharing methods and implementation methods in Linux. Www.2cto.com 1. You must first enable the portmap and nfs services. Service portmap start service nfs start 2. Check whether the service is enabled. Netstat-ntpl 3. Modify/etc/exports vi/etc/exports #/home/temp * (rw, sync, no_root_squash, all_squash)
/Home/temp * (ro, sync, no_root_squash, all_squash) (/home/temp indicates the directory to be shared)
/Mnt/inst * (ro, sync) (* indicates any address)
Below are some common NFS sharing parameters: www.2cto.com rw: read/write permission; ro: Read-Only permission; no_root_squash: the user logging on to the NFS host is a ROOT user, he has the ROOT permission root_squash: when the user who logs on to the NFS host using the directory is root, the user's permissions will be compressed into anonymous users, generally, his UID and GID will become the nobody identity;
All_squash: No matter what users log on to the NFS host, they will be reset to nobody. Anonuid: sets all users logging on to the NFS host to the specified user id, which must exist in/etc/passwd. Anongid: Same as anonuid, but changed to group ID! Sync: data is synchronized to the storage. Async: The data is temporarily stored in the memory and not directly written to the hard disk. Insecure allows unauthorized access from this machine. Www.2cto.com 4. exportfs-a (the shared directory everywhere) exportfs-rv (equivalent to restarting NFS) 5. showmount-e 127.0.0.1 (check the shared directory) Export list for 127.0.0.1: /mnt/inst */home/temp * 6. Enter the shared file on the client. Mount-t nfs 192.168.111.1:/mnt/inst/mnt (shared directory on the mount server) 7. Run the mount command on the client to view the file that was just mounted. In this way, file sharing is implemented.