First step, install Vsftp
# 1, execute the following command as Administrator (root) yum install vsftpd# 2, set boot vsftpd FTP service chkconfig vsftpd on# 3, start vsftpd service Service vsftpd start
Step Two, configure the firewall
# Open/etc/sysconfig/iptables Filevi /etc/sysconfig< Span class= "pun" >/iptables #在REJECT行之前添加如下代码 -a rh-firewall-1-input -m state --state NEW -m TCP -< Span class= "PLN" >p TCP --dport 21 -j accept #保存和关闭文件, restart firewall service iptables restart
Third, add the FTP user and set the FTP user password
Here is the Add Ftpuser user, set the root directory to/home/wwwroot/ftpuser, prevent this user from logging on to SSH, and restrict access to other directories.
1, modify the/etc/vsftpd/vsftpd.conf, will be the bottom three lines
#chroot_list_enable =yes# (default follows)#chroot_list_file =/etc/vsftpd.chroot_list
Switch
Chroot_list_enable=YES# (default follows)chroot_list_file=/etc/vsftpd/ chroot_list
2, add user Ftpuser, point to directory/home/wwwroot/ftpuser, prohibit login SSH permission.
-/home/wwwroot/--/sbin/nologin ftpuser
3. Set User password
passwd Ftpuser
4, edit the file chroot_list (content is FTP user name, each user occupies one line):
/etc/vsftpd/chroot_list
Fourth step, enable PASV mode
Pasv_enable=YES #启用被动模式pasv_min_port=10000#被动模式使用端口范围pasv_max_port= 10010#被动模式使用端口范围
Fifth step, for the fourth step to open the firewall port, if not enabled PASV mode can be
-A RH-Firewall-1--------10000:10010-J ACCEPT
An error occurred while connecting to FTP after the above operation was completed
OOPS: vsftpd:' ftp_username ':ftp
After the network search, get the following solution
Add a line to/etc/vsftpd.conf ftp_username=nobody it's done.
CentOS installation vsftp and configuring users