vsftpd虚拟用户

来源:互联网 发布:淘宝怎么合并订单 编辑:程序博客网 时间:2024/06/05 19:03
1.iptables,selinux都必须处于关闭状态;


2.创建用户密码文件
vim /etc/vsftpd/vuser.txt
dev
dev123
weihu
weihu123


3.生成db文件
db_load -T -t hash -f /etc/vsftpd/vuser.txt /etc/vsftpd/vuser.db


4.创建用户
useradd dev -s /sbin/nologin 
useradd weihu -s /sbin/nologin 


5.增加配置
/etc/vsftpd/vsftpd.conf
guest_enable=yes   #允许虚拟用户登录
user_config_dir=/etc/vsftpd/vsftpd_vuser_conf  #包含该目录下的配置文件


6.pam认证模块
vim /etc/pam.d/vsftpd
auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser
account required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser


7.创建配置目录
mkdir /etc/vsftpd/vsftpd_vuser_conf && cd /etc/vsftpd/vsftpd_vuser_conf


8.在配置目录下创建虚拟用户文件
vim dev                                         vim weihu
local_root=/ytxt/ftp                            local_root=/ytxt/ftp
write_enable=YES                                write_enable=YES
guest_username=dev                              guest_username=weihu
anon_umask=022                                  anon_umask=022
anon_world_readable_only=NO                     anon_world_readable_only=NO
anon_upload_enable=YES                          anon_upload_enable=YES
anon_mkdir_write_enable=YES                     anon_mkdir_write_enable=YES
anon_other_write_enable=YES                     anon_other_write_enable=YES


9.目录权限问题(根据实际需求配置)
chmod 755 /ytxt
chmod 755 /ytxt/ftp
chown weihu.weihu /ytxt/ftp/weihu
chown dev.dev /ytxt/ftp/dev
chmod 700 /ytxt/ftp/weihu
chmod 700 /ytxt/ftp/dev


10.启动服务
service vsftpd start
0 0
原创粉丝点击