匿名用户;
虚拟用户(未完成);
__________________________________________________
使用xinetd方式托管的时候,需要修改:“listen=NO”、“tcp_wrappers=NO”。
架设匿名 ftp 服务(托管方式)
# vi /etc/xinetd.d/vsftpd
# vsftpd 托管方式
service ftp
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/local/sbin/vsftpd
per_source = 5
instances = 200
no_access = 192.168.1.3
banner_fail = /etc/vsftpd.busy_banner
log_on_success += PID HOST DURATION
log_on_failure += HOST
}
# vi /etc/vsftpd/vsftpd.conf
# 定义访问权限
anonymous_enable=YES
local_enable=NO
write_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
# 安全设置
anon_world_readable_only=YES
connect_from_port_20=YES
hide_ids=YES
pasv_min_port=50000
pasv_max_port=60000
# 功能设定
xferlog_enable=YES
ls_recurse_enable=NO
ascii_download_enable=NO
async_abor_enable=YES
# 性能设定
one_process_model=YES
idle_session_timeout=120
data_connection_timeout=300
accept_timeout=60
connect_timeout=60
anon_max_rate=50000
# 目录设定
anon_root=/var/ftp
#local_root=/var/ftp/upload
# chkconfig xinetd on
# /etc/init.d/xinetd start
架设 ftp 服务器(独立运行)
# vi /etc/vsftpd/vsftpd.conf.200
# 独立运行
listen=YES
max_clients=200
max_per_ip=4
listen_address=172.16.44.200
# 匿名访问
anonymous_enable=YES
local_enable=NO
write_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
# 端口设定
anon_world_readable_only=YES
connect_from_port_20=YES
hide_ids=YES
pasv_min_port=50000
pasv_max_port=60000
# 功能设定
xferlog_enable=YES
ls_recurse_enable=NO
ascii_download_enable=NO
async_abor_enable=YES
# 连接超时、连接速率
one_process_model=YES
idle_session_timeout=120
data_connection_timeout=300
accept_timeout=60
connect_timeout=60
anon_max_rate=50000
# 目录设定
anon_root=/var/ftp
#local_root=/var/ftp/upload
# vsftpd /etc/vsftpd/vsftpd.conf.200
基于 ip 区别对待访问
如果源代码安装不支持,需要做些需修改,然后重新编译。找到文件 builddefs.h,从下边第一行修改为第二行的内容。
#undef VSF_BUILD_TCPWRAPPERS
#define VSF_BUILD_TCPWRAPPERS
# vi /etc/vsftpd/vsftpd.conf
tcp_wrappers=YES
配置 tcp_wrappers 的配置文件
# vi /etc/hosts.allow
vsftpd: 192.168.30.6: setenv VSFTPD_LOAD_CONF /etc/vsftpd/tcp_wrap/30.6.conf
vsftpd: 192.168.30.202: setenv VSFTPD_LOAD_CONF /etc/vsftpd_tcp_wrap/30.202.conf
vsftpd: ALL: DENY
虚拟用户1
# vi users
ftpuser
userpasswd
uploader
passwd2
# db_load -T -t hash -f users users.db
# chmod 600 users.db
# vi /etc/pam.d/vsftp
auth required /lib/security/pam_userdb.so db=/etc/vsftpd_login
account required /lib/security/pam_userdb.so db=/etc/vsftpd_login
# useradd -d /var/ftp virtual
# vi vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_wirte_enable=NO
chroot_local_user=YES
guest_enable=YES
guest_username=virtual
listen=YES
listen_port=21
pasv_min_port=30000
pasv_max_port=39999
# /etc/init.d/vsftpd start
虚拟用户2
# vi vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
userlist_deny=YES
userlist_file=/etc/vsftpd/denyuser
tcp_wrappers=YES