系统环境:192.168.1.62. centos6.4 64位系统
- 安装vsftp的软件包
yum install vsftpd
2.虚拟用户需要一个数据库的转换。安装所需要的软件
yum install db4*
db_load –T –t hash –f vftpuser.txt vftpuser.db 转换数据格式
3.增加pam认证 安装pam所需要的包
yum install pam*
编辑pam的配置文件
这个错误可以从/var/log/secure里面看出来
Sep 12 15:19:30 localhost sshd[24698]: Accepted password for root from 192.168.12.125 port 58767 ssh2
Sep 12 15:19:31 localhost sshd[24698]: pam_unix(sshd:session): session opened for user root by (uid=0)
Sep 12 15:41:19 localhost vsftpd[25062]: PAM unable to dlopen(/lib/security/pam_userdb.so): /lib/security/pam_userdb.so: cannot open shared object file: No such file or directory
Sep 12 15:41:19 localhost vsftpd[25062]: PAM adding faulty module: /lib/security/pam_userdb.so
Sep 12 15:41:20 localhost vsftpd[25064]: PAM unable to dlopen(/lib/security/pam_userdb.so): /lib/security/pam_userdb.so: cannot open shared object file: No such file or directory
Sep 12 15:41:20 localhost vsftpd[25064]: PAM adding faulty module: /lib/security/pam_userdb.so
4.增加真实用户
useradd -d /var/total virtualuser
usermod -s /sbin/nologin virtualuser
5.编辑vsftpd.conf的文件
[[email protected] pam.d]# grep -vE "#|^$" /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/xferlog
xferlog_std_format=YES
dual_log_enable=YES
vsftpd_log_file=/var/log/vsftpd.log
chroot_local_user=YES
listen=YES
pam_service_name=vsftpduser pam的配置文件
guest_enable=YES
guest_username=virtualuser
user_config_dir=/etc/vsftpd/user_conf用户配置的文件目录
local_root=/var/total/文件存放处
userlist_enable=YES
tcp_wrappers=YES
pasv_enable=YES
pasv_min_port=64000
pasv_max_port=65535
max_clients=30
max_per_ip=50
local_max_rate=512000
6.配置虚拟用户的配置
7.配置好了之后重启vsftpd进程