1. install vsftp and use the yum command to install vsftp [root @ Cloud12347 ~] # Yuminstallvsftpd-y2, add ftp account and directory check nologin location first, usually under/usr/sbin/nologin or/sbin/nologin. Use the following command to create an account
1. install vsftp
Use the yum command to install vsftp
[root@Cloud12347 ~]# yum install vsftpd -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/nologin pwftp
Modify the account password:
[root@Cloud12347 ~]# passwd pwftp
Modify the permission of a specified directory
[root@Cloud12347 ~]# chown -R pwftp.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@Cloud12347 home]# 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 ~]# service vsftpd start
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-get install vsftpd -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/nologin pwftp
Modify the account password:
[root@Cloud12347 ~]# passwd pwftp
Modify the permission of a specified directory
[root@Cloud12347 ~]# chown -R pwftp.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@Cloud12347 home]# 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 ~]# service vsftpd start
Then, use the account pwftp to test whether ftp can be logged on. The directory is/home/wwwroot.