今天,连接pure-ftpd的时候竟然不能登录,总是提示:
530 Login authentication failed
Pure-Ftpd安装在debian6上,所以与Centos下有些不同,启用调试模式:
[root@localhost ~]# lftp
lftp :~> open -u feifei,"123456" 192.168.2.23
lftp feifei@192.168.2.23:~> debug
lftp feifei@192.168.2.23:~> ls
---- 正在连接到 192.168.2.23 (192.168.2.23) 端口 21
<--- 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
<--- 220-You are user number 2 of 50 allowed.
<--- 220-Local time is now 02:46. Server port: 21.
<--- 220-This is a private system - No anonymous login
<--- 220-IPv6 connections are also welcome on this server.
<--- 220 You will be disconnected after 15 minutes of inactivity.
---> FEAT
<--- 211-Extensions supported:
<--- EPRT
<--- IDLE
<--- MDTM
<--- SIZE
<--- REST STREAM
<--- MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;
<--- MLSD
<--- AUTH TLS
<--- PBSZ
<--- PROT
<--- UTF8
<--- TVFS
<--- ESTA
<--- PASV
<--- EPSV
<--- SPSV
<--- ESTP
<--- 211 End.
---> AUTH TLS
<--- 500 This security scheme is not implemented
---> OPTS UTF8 ON
<--- 200 OK, UTF-8 enabled
---> OPTS MLST type;size;modify;UNIX.mode;UNIX.uid;UNIX.gid;
<--- 200 MLST OPTS type;size;sizd;modify;UNIX.mode;UNIX.uid;UNIX.gid;unique;
---> USER adminis
<--- 331 User feifei OK. Password required
---> PASS 123456
<--- 530 Login authentication failed
---> PWD
ls: 登录失败: 530 Login authentication failed
<--- 530 You aren't logged in
---> QUIT
<--- 221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
<--- 221 Logout.
---- 关闭控制连接
pure-ftpd是使用puredb方式认证的,通过查看/usr/sbin/pure-ftpd-wrapper这个perl脚本后,发现下面一段代码:
119 # examine authentication files in /etc/pure-ftpd/auth
120
121 my @authfiles;
122
123 opendir (ETCAUTH, '/etc/pure-ftpd/auth')
124 || die "$0: Couldn't examine directory /etc/pure-ftpd/auth: $!n";
125 @authfiles = sort (grep {-l "/etc/pure-ftpd/auth/$_"} readdir (ETCAUTH));
126 closedir (ETCAUTH);
上面,很清楚写着会检查/etc/pure-ftpd/auth/这个目录的认证文件,并且用sort进行排序,于是,我查看了一下服务器的/etc/pure-ftpd/auth/这个目录:
root@vps:~# ls /etc/pure-ftpd/auth
65unix 70pam
发现就只有pam和unix认证方式的认证文件,而没有puredb的,因为我的是使用puredb认证的,于是进行以下步骤:
root@vps:/etc/pure-ftpd/auth# ln -s /etc/pure-ftpd/conf/PureDB 60puredb #前面的60就是用于排序的
root@vps:/etc/pure-ftpd/auth# ls
60puredb 65unix 70pam
root@vps:/etc/pure-ftpd/auth# /etc/init.d/pure-ftpd restart
Restarting ftp server: Running: /usr/sbin/pure-ftpd -l puredb:/etc/pure-ftpd/pureftpd.pdb -l pam -O clf:/var/log/pure-ftpd/transfer.log -u 1000 -8 UTF-8 -E -B
可以看到,上面的启动参数已经增加了:-l puredb:/etc/pure-ftpd/pureftpd.pdb,而原来的启动参数如下:
root@vps:/etc/pure-ftpd/auth# /etc/init.d/pure-ftpd restart
Restarting ftp server: Running: /usr/sbin/pure-ftpd -l pam -O clf:/var/log/pure-ftpd/transfer.log -u 1000 -8 UTF-8 -E -B