1.安装pam_mysql-0.7RC1.tar.gz
2.创建一个必要的本地用户
虽说是虚拟用户,不过,由于虚拟用户的信息存储在MySQL数据库中,所以还是需要一个能够读取MySQL数据库的本地用户.
3.创建用于存储虚拟用户信息的表users
mysql>use ftpvuser;
mysql>CREATE TABLE users (username varchar(20) NOT NULL,password varchar(40) NOT NULL,PRIMARY KEY (username)) TYPE=MyISAM;
4.让本地用户ftpguest能读取ftpvuser数据库的users表的内容
mysql>grant select on ftpvuser.users to ftpguest@localhost identified by 'YourPassword';
mysql>flush privileges;
5.建立虚拟用户
mysql>insert into users values ('vu1','123');
mysql>insert into users values ('vu2','123');
mysql>insert into users values ('vu3','123');
6.配置vsftpd的PAM验证
vi /etc/pam.d/vsftpd
auth required pam_mysql.so user=ftpguest passwd=YourPassword host=localhost db=ftpvuser table=users usercolumn=username passwdcolumn=password crypt=0
account required pam_mysql.so user=ftpguest passwd=YourPassword host=localhost db=ftpvuser table=users usercolumn=username passwdcolumn=password crypt=0
7./etc/vsftpd/vsftpd.conf
guest_enable=YES
guest_username=ftpguest
anon_world_readable_only=NO
anon_upload_enable=YES
user_config_dir=/etc/vsftpd/vsftpd_user_conf
转载于:https://www.cnblogs.com/centos-python/articles/8522683.html