在ECS上部署FTP服务

安装及配置

$ apt-get install vsftpd -y
$ systemctl start vsftpd   # 启动
$ systemctl enable vsftpd  # 允许开机自启
$ netstat -antup | grep ftp # 检查服务是否启动
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      501/vsftpd

$ adduser ftptest # 创建新用户
$ mkdir -p /var/ftp/test # ftp 数据目录
$ chown -R ftptest:ftptest /var/ftp/test/

$ cat << EOF > /etc/vsftpd.conf
listen=YES
anonymous_enable=NO
local_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
allow_writeable_chroot=YES
local_root=/var/ftp/test
pasv_enable=YES
pasv_address=xx.xx.xx.xx # ECS IP
pasv_min_port=20
pasv_max_port=21
EOF
$ systemctl restart vsftpd.service

验证

本地wsl上执行下面的命令:

$ ftp ${ECS IP地址}                           
Connected to xx.xx.xx.xx .
220 (vsFTPd 3.0.3)
Name (xx.xx.xx.xx:ftptest): ftptest
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 
上一篇:jmeter—JSON提取器


下一篇:IOS最新新浪微博开放平台Oauth2.0授权获取Access_Token