On a virtual machine FTP FTP access mode (virtual user mode)

User-mode virtual account passwords are not the real present in the system, so long as the proper configuration of the virtual user mode than the local user mode safer

First, you need to have vsftpd service can be downloaded yum go in (of course you need to have a local yum repository)

Enter the command: yum install vsftpd

After the download is complete open the vsftpd service      

Enter the command: systemctl start vsftpd

 

 

 First, download the service yum install vsftpd -y

Step 1: Create a virtual FTP user database file.

Vsftpd switch to the program directory, then modify this file will be written into the user name and password  

Enter the command: cd / etc / vsftpd /

FTP user to create a database used to generate the original account and password files :

Enter vim vuser.list (singular behavior accounts, double the number of acts password) to create three virtual friends Users

 

 

 Use db_load command generated FTP user database file vuser.db with HASH algorithm:

输入: db_load -T -t hash -f vuser.list vuser.db

 

 

 View database file types: file vuser.db

 

 

 FTP user database content is very sensitive, so permission to smaller: chmod 600 vuser.db

 

 

 

Delete the original account and password file: rm -f vuser.list

Step 2: Create a system user FTP root directory and virtual user mapping.

Create a virtual user and set to not allow landing system and define the user's home directory: useradd -d / var / ftproot -s / sbin / nologin virtual

View the user's home directory permissions: ls -ld / var / ftproot /

To ensure that other users can access, giving rwxr-xr-x permissions: chmod -Rf 755 / var / ftproot /

 

 

 Step 3: Create a virtual user support PAM authentication file: vim /etc/pam.d/vsftpd.vu

// db parameter is used to point just generated vuser.db file, but do not write the suffix.

auth       required     pam_userdb.so db=/etc/vsftpd/vuser

account    required     pam_userdb.so db=/etc/vsftpd/vuser

 

 

 

Step 4: Add support vsftpd.conf configuration file.
As to the use of virtual user mode , and virtual user mode are far better than anonymous access mode is more secure, but also closed configuration anonymous open mode . The following input parameters are changed: vim /etc/vsftpd/vsftpd.conf

 

 

 

 

 

 

 

 

 

 Step 5: Set different permissions for virtual users

If you want users to be able to fully manage the information in the FTP, FTP program supports they need to be independent of the user rights profiles

Let's look at the configuration file (file no words to add, modify some words)

Enter the command: vim /etc/vsftpd/vsftpd.conf

Create a separate user rights profiles stored in the directory: mkdir / etc / vsftpd / vusers_dir /

Switching into the directory: cd / etc / vsftpd / vusers_dir /

Create a blank linuxuser1 configuration file: touch linuxuser1

Specific authority designated linuxuser1 users: enter the command: vi linuxuser1

 

 anon_upload_enable=YES

anon_mkdir_write_enable=YES

anon_other_write_enable=YES

 

 

Next we restart the service: systemctl restart vsftpd

 

 

 

Into the second virtual machine (the client) enter ftp + ip

Enter your user name and password before good design

 

 

  Of course we also have permission to create folder

 

Of course, we can also operate in the windows (user-mode virtual access ftp)

It is also set to enter their user name and password (this file is just in a virtual machine construction)

 

 

 This is a virtual user we'll set up a server (because we set the three at the top) Repeat the above process

 

 

 Go to the local machine, search ftp: // ip

 

 

 

That file is displayed

 

Guess you like

Origin www.cnblogs.com/escwq/p/11783884.html