vsftpd 是一个 UNIX 类操作系统上运行的服务器的名字,它可以运行在诸如 Linux, BSD, Solaris, HP-UX 以及 IRIX 上面。它支持很多其他的 FTP 服务器不支持的特征。比如:
- 非常高的安全性需求
- 带宽限制
- 良好的可伸缩性
- 创建虚拟用户的可能性
- IPv6支持
- 中等偏上的性能
- 分配虚拟 IP 的可能性
- 高速
一个例子就是 vsftpd 是在 chroot 模式下工作的,chroot 模式就是为程序(这里就是 vsftpd 了)单独指定一个新的目录,它也就不能访问那个目录之外的程序和文件了 --- 所以这也称为“被锁上的”。一个可能被潜在的攻击者破坏的 FTP 服务器将被从系统的其他部分独立开来,从而避免了更大的损失。
由于有了如此多的特性,其中 FTP 服务的安全性应该是最重要的,vsftpd 比其他 FTP 服务器更加优越。
1.安装vsftpd
直接从源里面安装,easy
sudo apt-get install vsftpd
2.配置文件
通过sudo gedit /etc/vsftpd.conf修改。
我的配置:
- anonymous_enable=Yes
- local_enable=YES
- write_enable=YES
- local_umask=022
- #chroot_local_user=NO
- chroot_list_enable=YES
- chroot_list_file=/etc/vsftpd.chroot_list
- local_root=/home/ftp
- anon_root=/home/ftp
# 服务器以 standalong 模式运行,如果以 root 用户直接启动 vsftpd 进程,则必须。
# 注销语句以 xinetd 方式运行
listen=YES
write_enable=YES
anonymous_enable=YES
local_enable=YES
# 注意 vsftp 版本,某些旧版的该选项会被 chown_uploads/chown_username 二选项覆盖
local_umask=022
anon_upload_enable=YES
# 注意点同 local_umask
anon_umask=022
anon_mkdir_write_enable=YES
#anon_other_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
#chown_uploads=YES
#chown_username=whoever
#xferlog_file=/var/log/vsftpd.log
#xferlog_std_format=YES
#idle_session_timeout=600
ftpd_banner=Welcome to feifei FTP service.
#banned_email_file=/etc/vsftpd.banned_emails
# chroot 在登录后所在目录中,无法离开。如果为 YES,则所记录的用户将不被 chroot。
chroot_local_user=YES
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd.chroot_list
secure_chroot_dir=/var/run/vsftpd
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
此外还有开启关闭服务的命令
sudo /etc/init.d/vsftpd stop
这样,就可以使用电脑的IP地址登陆这个ftp服务器了。输入ftp://127.0.0.1/访问