安装很简单,都是一行:
debian/ubuntu:
apt-get install vsftpd
freebsd:
pkg install -y vsftpd-ext
配置文件也都大同小异,直接贴出来:
debian 9(我估计ubuntu也可以直接用):
listen=YES listen_port=21 anonymous_enable=NO local_enable=YES pam_service_name=vsftpd_local_and_virtual chroot_local_user=YES chroot_list_enable=NO chroot_list_file=/etc/vsftpd/chroot_list ftpd_banner=Welcome to www.tingtao.org FTP service. write_enable=YES download_enable=YES dirlist_enable=YES local_umask=022 dirmessage_enable=YES xferlog_enable=YES xferlog_file=/var/log/xferlog connect_from_port_20=YES connect_timeout=60 data_connection_timeout=300 idle_session_timeout=300 local_max_rate=0 max_clients=0 max_per_ip=5 allow_writeable_chroot=YES
freebsd:
anonymous_enable=no local_enable=YES write_enable=YES local_umask=077 anon_upload_enable=no anon_mkdir_write_enable=no dirmessage_enable=no xferlog_enable=YES connect_from_port_20=YES chown_uploads=no chown_username=whoever xferlog_file=/var/log/vsftpd.log xferlog_std_format=YES idle_session_timeout=600 data_connection_timeout=120 ftpd_banner=Welcome to www.tingtao.org FTP service. chroot_local_user=YES chroot_list_enable=no listen=yes secure_chroot_dir=/usr/local/share/vsftpd/empty background=YES allow_writeable_chroot=YES
配置为拒绝匿名用户,只接受本地用户登录,封锁用户只允许操作自己的home目录,ftp常规功能全都正常使用。
补充一个小坑,默认为UTF-8编码的客户端(比如FlashFXP)在FreeBSD+VSFTPD下(Debian没测试)会无法删除中文目录和文件,需要将客户端的字符编码改成ASCII之类的。而这个问题在其他ftp服务器上面没遇到过。