apt update &&
apt install vsftpd -y &&
systemctl enable vsftpd &&
systemctl restart vsftpd &&
cp /etc/vsftpd.conf /etc/vsftpd.conf.bak &&
echo ftp_user >> /etc/allowed_users &&
mkdir /opt/ftp/home &&
cd /opt/ftp/home &&
chmod -R 777 /opt/ftp/home &&
useradd -d /opt/ftp/home ftp_user &&
passwd ftp_user
输入密码确认
vim /etc/vsftpd.conf
末尾追加:
listen=YES
listen_ipv6=NO
chroot_local_user=YES
userlist_deny=NO
userlist_enable=YES
userlist_file=/etc/allowed_users
local_enable=YES
write_enable=YES
anonymous_enable=NO
allow_writeable_chroot=YES
pasv_enable=YES
pasv_promiscuous=YES
port_enable=NO
port_promiscuous=NO
virtual_use_local_privs=YES
local_umask=022
anon_umask=022
pasv_min_port=PASV最小端口
pasv_max_port=PASV最大端口
pasv_address=公网ip
systemctl restart vsftpd
创建容器时需映射ftp端口、pasv_min_port、pasv_max_port