File Sharing between linux and file sharing in linux
Because an application was loaded yesterday, the application will upload files. To ensure file synchronization, you need to share a file. In Linux, Network File Service (Network File System NFS) can be used to share files.
Generally, the NFS system is installed in linux by default. First, set host A. A directory in host A is shared and can be read and written by other hosts.
Vi/etc/exports # set in this file
/Home/work * (rw, sync, no_root_squash)
This statement indicates that all hosts can share/home/work on host A. the permissions are as follows:
Rw: read/write permission. the read-only permission is ro;
Sync: indicates that all data is written to the shared data upon request, that is, data is synchronized to the memory and hard disk;
No_root_squash: Allows clients mounted to this directory to enjoy the root identity of the host.
Edit and save and execute the following command:
Servicenfs restart ---- Enable nfs service
Showmount-e 172.16.50.21 (this command can check all mounted directories on the host)
For host B (the directory that needs to be shared with A), perform the following operations:
Vi/etc/fstab
172.16.50.21:/home/apache-tomcat-7.0.34/webapps/CHMOManager/download/softversion/home/tomcat/apache-tomcat-7.0.34/webapps/CHMOManager/download/softversion nfs ults 0 0
In this example, the file system of directory 21 is nfs, which is shared to host B/home/tomcat/apache-tomcat-7.0.34/webapps/CHMOManager/download/softversion, ults is the default configuration
Then run mount-a to mount the file. (Do not run this command in the shared directory. Otherwise, the command cannot be executed)