vsftpd is the abbreviation of "very secure FTP daemon", which is a completely free, source code ftp server software.
vsftpd is the most respected FTP server program in Linux distributions. It is small and light, safe and easy to use, supports virtual users, supports bandwidth restrictions and other functions.
System environment: CentOS 6.8 64 bit
vsftpd version: vsftpd-2.22-21.el6.x86_64
1. Excuting an order
yum -y install vsftpd
ps: (1) Whether to execute with sudo permissions is determined according to the specific environment; (2) rpm -qa | grep vsftpd can check whether vsftpd has been installed through this; (3) The default configuration file is in /etc/vsftpd/vsftpd.conf.
2. Create a new folder under the directory: /product/ftpfile/
**3. Add an anonymous user ftpuser, command: **
sudo useradd ftpuser -d /product/ftpfile -s /sbin/nologin
**4. Modify the permissions of the file ftpfile, command: **
sudo chown -R ftpuser.ftpuser ./ftpfile/
**5. Reset the password of ftpuser, command: **
sudo passed ftpuser
6. Enter the /etc/vsftpd directory, create a new file chroot_list, add content: ftpuser:
Add the newly created virtual user ftpuser to this configuration file, which will be referenced later.
**7. Create a new file index.html under the ftpfile folder and enter the content: **
this is a ftpfile demo
/ftpfile
8. Open the file in the /etc/vsftpd directory: vsftpd.conf, modify or add the following configuration:
local_root=/product/ftpfile
# chroot_local_user=YES
anon_root=/product/ftpfile
use_localtime=YES
# anonymous
# anonymous_enable=YES
anonymous_enable=NO
# pasv_enable=YES
pasv_min_port=61001
pasv_max_port=62000
9. Add configuration to the firewall:
Firewall location:
Add configuration:
# vsftpd
- A INPUT -p TCP --dport 61001:62000-j ACCEPT
- A OUTPUT -p TCP --sport 61001:62000-j ACCEPT
- A INPUT -p TCP --dport 20-j ACCEPT
- A OUTPUT -p TCP --sport 20-j ACCEPT
- A INPUT -p TCP --dport 21-j ACCEPT
- A OUTPUT -p TCP --sport 21-j ACCEPT
Restart the firewall:
sudo service iptables restart
Restart vsftpd:
sudo service vsftpd restart
ps: The first startup is Shutting down vsftp is failed. Don't care, because this is a restart command. Ensure that Starting vsftpd is OK, which means that the vsftpd service is successful.
**10. Modify the security group policy: sudo vi /etc/selinux/config, check to ensure that SELINUX=disabled. **
In order to avoid the 550 access denied error in the verification, enter the command:
sudo setsebool -P ftp_home_dir 1
11. Start the browser: ftp://120.77.86.200, enter the user name ftpuser and password xxx:
Commonly used commands:
sudo service vsftpd start #start up
sudo service vsftpd stop #shut down
sudo service vsftpd restart #Reboot
The above is the whole content of this article, I hope it will be helpful to everyone's study.
Recommended Posts