vsftpd虚拟用户配置(文本模式)
1、安装vsftpd[*]yum install db4-utils db4 vsftpd
2、创建虚拟用户数据库
[*]cd /etc/vsftpd
[*]vi vusers.txt
内容如下:
[*]vivek
[*]vivekpass
[*]sayali
[*]sayalipass
现在创建数据库:
[*]db_load -T -t hash -f vusers.txt vsftpd-virtual-user.db
[*]chmod 600 vsftpd-virtual-user.db vusers.txt
3、配置vsftpd以支持虚拟用户
[*]anonymous_enable=NO
[*]local_enable=YES
[*]# Virtual users will use the same privileges as local users.
[*]# It will grant write access to virtual users. Virtual users will use the
[*]# same privileges as anonymous users, which tends to be more restrictive
[*]# (especially in terms of write access).
[*]virtual_use_local_privs=YES
[*]write_enable=YES
[*]
[*]# Set the name of the PAM service vsftpd will use
[*]# RHEL / centos user should use /etc/pam.d/vsftpd
[*]pam_service_name=vsftpd.virtual
[*]
[*]# 激活虚拟用户
[*]guest_enable=YES
[*]
[*]# Automatically generate a home directory for each virtual user, based on a template.
[*]# For example, if the home directory of the real user specified via guest_username is
[*]# /home/virtual/$USER, and user_sub_token is set to $USER, then when virtual user vivek
[*]# logs in, he will end up (usually chroot()'ed) in the directory /home/virtual/vivek.
[*]# This option also takes affect if local_root contains user_sub_token.
[*]user_sub_token=$USER
[*]
[*]# 设置虚拟用户根目录
[*]local_root=/home/vftp/$USER
[*]
[*]# Chroot user and lock down to their home dirs
[*]chroot_local_user=YES
[*]
[*]# Hide ids from user
[*]hide_ids=YES
4、创建PAM文件
[*]vi /etc/pam.d/vsftpd.virtual
内容如下:
[*]#%PAM-1.0
[*]auth required pam_userdb.so db=/etc/vsftpd/vsftpd-virtual-user
[*]account required pam_userdb.so db=/etc/vsftpd/vsftpd-virtual-user
[*]session required pam_loginuid.so
5、创建相关目录
[*]# mkdir /home/vftp
[*]# mkdir -p /home/vftp/{vivek,sayali}
[*]# chown -R ftp:ftp /home/vftp
6、重启vsftpd
[*]service vsftpd restart
写的真的很不错 精典之极就是精斑!!! 昨天,系花对我笑了一下,乐得我晚上直数羊,一只羊,两只羊,三只羊…… 过来看看的 我的id是假冒的,大家不要相信我是骗子。 锻炼肌肉,防止挨揍!
页:
[1]