VSFTP

1. 安装vsftp

1
apt install vsftpd

vsftp有三种模式,分别为:

  • 匿名开放模式
  • 本地用户模式
  • 虚拟用户模式

2. 匿名开放模式

最不安全,任何人都无需密码即可登录.

配置此模式需要开放匿名用户的上传、下载、创建、更名、删除文件的权限

配置文件示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
listen=NO
listen_ipv6=YES
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
dirmessage_enable=YES
use_localtime=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
data_connection_timeout=120
#nopriv_user=ftpsecure
async_abor_enable=YES
ascii_upload_enable=YES
ascii_download_enable=YES
ftpd_banner=Welcome to blah FTP service.
#deny_email_enable=YES
#banned_email_file=/etc/vsftpd.banned_emails
#chroot_local_user=YES
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd.chroot_list
ls_recurse_enable=YES

3. 本地用户模式

vsftp.conf:

1

pam.d/vaftp:

1

4. 虚拟用户模式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
guest_enable=YES
guest_username=vsftp
allow_writeable_chroot=YES
local_root=/home/vsftp
write_enable=YES
local_umask=022
userlist_enable=YES
# 只允许 /etc/vsftpd.user_list 中的用户登录
userlist_deny=NO
#anon_root=/home/ftp
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
dirmessage_enable=YES
use_localtime=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
data_connection_timeout=120
#nopriv_user=ftpsecure
async_abor_enable=YES
ascii_upload_enable=YES
ascii_download_enable=YES
ftpd_banner=Welcome to blah FTP service.
#deny_email_enable=YES
#banned_email_file=/etc/vsftpd.banned_emails
#chroot_local_user=YES
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd.chroot_list
ls_recurse_enable=YES
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
tcp_wrappers=YES
user_config_dir=/etc/vsftp/userconfig
utf8_filesystem=YES

pam.d/vsftp:

1
2
account	required	pam_userdb.so db=/etc/vsftpd/vsftpusers
auth required pam_userdb.so db=/etc/vsftpd/vsftpusers

日志文件:/var/log/vaftpd.log

配置文件:/etc/vsftp.conf

用户目录:/etc/vsftpd/vsftpusers,加密后为``/etc/vsftpd/vsftpusers.db`

允许登录的用户:/etc/vsftpd.user_list

虚拟用户配置文件:/etc/vsftpd/vsftpusersconfig

评论

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×