FTP通过PAM认证连接mysql数据库认证用户

FTP通过PAM认证连接mysql数据库认证用户

pam_vsftpd_mysql
1.安装mysql数据库
yum install mysql mysql-server mysql-devel
创建mysql数据库
mysql �Cu root -p
create database vsftpd;
创建用户信息表
Create table users(username varchar(20) not null,password varchar(40) not null,primary key

(username)) type=MyISAM;
授权本地用户 virtual 读取 vsftpd数据库users表
grant select on vsftpd.users to virtual@localhost identified by '123456';
刷新授权
flush privileges;
建立虚拟用户
insert into users values('xiao','123');
2.解压安装pam_mysql-0.7RC1.tar.gz
tar xvf pam_mysql-0.7RC1.tar.gz �CC /usr/local/src
cd pam_mysql-0.7RC1
./configure --with-openssl
make && make install
ls /usr/lib/security
ls �Cs /usr/lib/security/pam_mysql.so/lib/security/pam_mysql.so
3.安装vsftpd
yum install vsftpd
vsftp参数配置
pam_service_name=vsftpd_mysql
guest_enable=YES
guest_username=virtual
virtual_use_local_privs=YES
4.创建本地用户
useradd -s /sbin/nologin virtual
5.配置vsftpd支持pam验证
vim /etc/pam.d/vsftpd_mysql
auth required pam_mysql.so user=virtual passwd=123456 host=localhost db=vsftpd table=users

usercolumn=username passwdcolumn=password crypt=0
account required pam_mysql.so user=virtual passwd=123456 host=localhostdb=vsftpd table=users

usercolumn=username passwdcolumn=password crypt=0

你可能感兴趣的:(database,primary,password,数据库认证,identified)