CentOS uses the yum command to install vsftp
1. Install vsftp
Use the yum command to install vsftp
[root@Cloud12347~]#yuminstallvsftpd-y
2. Add an ftp account and Directory
First check the location of nologin, usually under/usr/sbin/nologin or/sbin/nologin.
Use the following command to create an account. The command specifies/home/wwwroot as the root directory of user pwftp. You can define the account name and directory by yourself:
[root@Cloud12347~]#useradd-d/home/wwwroot-s/sbin/nologinpwftp
Modify the account password:
[root@Cloud12347~]#passwdpwftp
Modify the permission of a specified directory
[root@Cloud12347~]#chown-Rpwftp.pwftp/home/wwwroot
3. Configure vsftp
To edit the vsftp configuration file, run the following command:
[root@Cloud12347~]#vi/etc/vsftpd/vsftpd.conf
Change "anonymous_enable = YES" in the configuration file to "anonymous_enable = NO"
Cancel the annotator before the following Configuration:
local_enable=YES write_enable=YES chroot_local_user=YES
Save the modification, Press ESC, and enter: wq
If the configuration file does not contain "chroot_local_user = YES", enter the following command and press Enter.
[root@Cloud12347home]#echo'chroot_local_user=YES'>>/etc/vsftpd/vsftpd.conf
4. Modify shell configurations
Vi edit/etc/shells. If the file does not contain/usr/sbin/nologin or/sbin/nologin (depending on the current system configuration), append it
5. Start vsftp and test Logon
Run the following command to start the vsftp service:
[root@Cloud12347~]#servicevsftpdstart
Then, use the account pwftp to test whether ftp can be logged on. The directory is/home/wwwroot.
Ii. Install vsftp in Ubuntu/Debian
1. Install vsftp
Use the apt-get command to install vsftp
[root@Cloud12347~]#apt-getinstallvsftpd-y
2. Add an ftp account and Directory
First check the location of nologin, usually under/usr/sbin/nologin or/sbin/nologin.
Use the following command to create an account. The command specifies/home/wwwroot as the root directory of user pwftp. You can define the account name and directory by yourself:
[root@Cloud12347~]#useradd-d/home/wwwroot-s/sbin/nologinpwftp
Modify the account password:
[root@Cloud12347~]#passwdpwftp
Modify the permission of a specified directory
[root@Cloud12347~]#chown-Rpwftp.pwftp/home/wwwroot
3. Configure vsftp
To edit the vsftp configuration file, run the following command:
[root@Cloud12347~]#vi/etc/vsftpd/vsftpd.conf
Change "anonymous_enable = YES" in the configuration file to "anonymous_enable = NO"
Cancel the annotator before the following Configuration:
local_enable=YES write_enable=YES chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftpd.chroot_list
Save the modification, Press ESC, and enter: wq
If the configuration file does not contain "chroot_local_user = YES", enter the following command and press Enter.
[root@Cloud12347home]#echo'chroot_local_user=YES'>>/etc/vsftpd/vsftpd.conf
Edit the/etc/vsftpd. chroot_list file, add the ftp account name, save and exit.4. Modify shell configurations
Vi edit/etc/shells. If the file does not contain/usr/sbin/nologin or/sbin/nologin (depending on the current system configuration), append it
5. Start vsftp and test Logon
Run the following command to start the vsftp service:
[root@Cloud12347~]#servicevsftpdstart
Then, use the account pwftp to test whether ftp can be logged on. The directory is/home/wwwroot.