Linux CentOS installation vsftpd server

Time:2020-2-26

install

  • Check whether vsftpd server exists on the computer
 rmp -qa|grep vsftpd
  • If yes, remove it. If no, install vsftpd using yum
 yum -y install vsftpd

To configure

  • Create the ftpfile directory in the root directory:
CD \ ා back to root
 MKDIR ftpfile create ftpfile folder

Linux CentOS installation vsftpd server

  • Create user for ftpfile
 sudo useradd ftpuser -d /ftpfile/ -s /sbin/nologin
  • Give users permission
 sudo chown -R ftpuser.ftpuser /ftpfile/
  • Back to root
 cd \
  • Change the user password you just created
 sudo passwd ftpuser
  • View the path of vsftpd
 whereis vsftpd 
  • Configure vsftpd
 vim /etc/vsftpd/vsftpd.conf
  • Add and modify the following information in vsftpd.conf
#Anonymous access
anonymous_enable=NO

#New node
ftpd_banner=Welcome to huaianmall FTP service.
local_root=/ftpfile
anon_root=/ftpfile
use_localtime=yes

#chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list
  • Create chroot list file
 vim /etc/vsftpd/chroot_list
  • Add the user you just created

Linux CentOS installation vsftpd server

  • Restart service
 service vsftpd restart

Linux CentOS installation vsftpd server

  • Plus the related port of anonymous transmission
#Open file
 vim /etc/vsftpd/vsftpd.conf

#Plus port information
 pasv_min_port =61001
 pasv_max_port=62000
 sudo vim /etc/sysconfig/iptables
  • Firewall settings
 
# 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 –dport 20 -j ACCEPT
-A INPUT -p tcp –dport 21 -j ACCEPT
-A OUTPUT -p tcp –dport 21 -j ACCEPT
  • Save the exit and save the exit with the “: WQ” command of vim. If you are still editing, you need to press ESC to enter the command.
  • Restart vsftpd server
sudo service iptables restart

Linux CentOS installation vsftpd server

End

OK, that’s the configuration of vsftpd.