Linux note ③ (ftp, nfs, and ssh server construction), nfsssh
1. Set up an ftp server (using vsftpd)
Purpose: upload and download files
Server:
Modify the configuration file directory:/etc/vsftpd. conf. Modify the settings to allow anonymous access and specify the anonymous access directory.
Restart the service: Command -- sudo service vsftpd restart
Client:
There are two situations:
① Real-name user login: ftp + ip (server), and then enter the user name and password respectively.
② Anonymous user login: ftp + ip (server), and then the user name is anonymous. You don't need to enter the password, just press Enter.
However, if you log on anonymously, the Administrator usually specifies the root directory for anonymous logon. After Anonymous logon, the administrator can only access the specified directory. The Administrator only needs to modify/etc/vsftpd. conf in the root directory of an anonymous user and add anon_root =/home/cczhao/MyFtp.
However, the above two login methods can only operate on a single file, such as uploading or downloading a single file, not a folder, or operating multiple files at a time. The above disadvantages can be solved in the following way.
Lftp client accesses the ftp server -- install the client
Brief Introduction: Software Installation ---- sudo apt-get install lftp; Anonymous Logon: lftp + ip (server), then enter the login user name, and press enter directly. Operation: upload or download a single file or put/get, upload or download multiple files mput/mget, download the entire directory and its sub-directories using the command mirror, run the mirror-R command to upload the entire directory and Its subdirectories.
2. Build an nfs server-use the nfs-kernel-server Tool
The nfs server is similar to a shared folder in Windows. This function is implemented through mounting.
First install the software: sudo apt-get install nfs-kernel-server
Server: create a shared directory where all files or folders to be shared are stored. Then, modify the configuration file in the/etc/exports directory, add/home/cczhao/NfsShare * (rw, sync) at the end of the file ). Here * refers to the sharing location, that is, an IP network segment. You can also write the corresponding IP network segment as needed (for example, 192.168.60. *); rw is the permission granted to the visitor. sync indicates real-time update to the local disk. Restart the service: sudo service nfs-kernel-server restart.
Client: mount the shared folder to/mnt. Command: mount IP: mounted directory/mnt (mount 192.168.130. *:/home/cczhao/NfsShare/mnt ).
3. Create an ssh server
Role: Remote Server operations
Server: install ssh, that is, sudo apt-get install openssh-server
Client:
Remote Logon: ssh userName @ serverIP
Log out: logout
Here we will introduce a scp (super copy), which requires openssh-server to be installed and can be copied between different hosts. Follow these steps: scp-r: Target Host @ Target Host IP Address: the absolute path of the file on the target host must be copied to the absolute path of the local host.