一、VSFTP配置
vsftpd.conf的配置。PORT安裝
listen=yes
guest_enable=yes
guest_username=vsftpdguest
其它按默認配置。
二、PAM驗證配置 /etc/pam.d/ftp,使用默認ftp的文件,但已經將/etc/pam.d/ftp清空,填入如下,
auth required pam_mysql.so user=vsftpdguest passwd=vsftpdguest host=localhost db=vsftpd table=us
ers usercolumn=name passwdcolumn=passwd crypt=2
account required pam_mysql.so user=vsftpdguest passwd=vsftpdguest host=localhost db=vsftpd table =users usercolumn=name passwdcolumn=passwd crypt=2 用wc -l /etc/pam.d/ftp返回值爲2行。 三、MYSQL內的數據庫配置 # mysql mysql> create database vsftpd; mysql> use vsftpd; mysql> create table users(name varchar(20) binary,passwd varchar(50) binary); mysql> insert into users (name,passwd) values ('test',password('123456')); mysql> grant select on vsftpdvu.users to vsftpdguest@localhost identified by 'vsftpdguest'; 四、測試新建的users表是否正常 mysql -u vsftpdguest -ptest vsftpd mysql>use vsftpd; mysql>select * from users; 返回結果爲test 和加密後的123456 碼. 五、登錄測試 app# ftp localhost Trying ::1... ftp: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. 220 (vsFTPd 2.0.5) Name (localhost:root): test 331 Please specify the password. Password: