Ubuntu 16.04.6 build FTP server
Install vsftpd3.0.3 (FTP server)
sudo apt install vsftpd
configure vsftpd
- open configuration file
vim /etc/vsftpd.conf
- Modify the following configuration items
listen=YES
listen_ipv6=NO
use_localtime=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
connect_from_port_20=YES
chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
pam_service_name=ftp
user_sub_token=$USER
local_root=/home/$USER/ftp
anon_root=/home/$USER/ftp
allow_writeable_chroot=YES
pasv_enable=YES
pasv_min_port=61001
pasv_min_port=62000
- Add the newly added virtual user (ftpuser) to the vsftpd.chroot_list file, which will be referenced later
vim /etc/vsftpd.chroot_list
- start service
service vsftpd start
service vsftpd restart
service vsftpd stop
service vsftpd status
Create virtual users
- Choose to create an ftp folder in the root directory or user directory
mkdir -p /home/ftpuser
- add anonymous user
useradd ftpuser -d /home/ftpuser -s /sbin/nologin
- reset ftpuser password
passwd ftpuser (123456)
- Create a new user FTP folder and modify permissions
mkdir /home/ftpuser/ftp
chmod 777 -R /home/ftpuser/ftp
Create a new user example
- Create user ftp folder
mkdir -p /home/tju
- add anonymous user
useradd tju -d /home/tju -s /sbin/nologin
- reset tju password
passwd tju (qwer1234)
- Create a new user FTP folder and modify permissions
mkdir /home/tju/ftp
chmod 777 -R /home/tju/ftp
- Add the newly added virtual user (tju) to the /etc/vsftpd.chroot_list file
- restart service
service vsftpd restart