在 CentOS 6.x 上安裝 ProFTPd FTP Server
# yum install proftpd proftpd-ldap proftpd-mysql –enablerepo=epel
啟動 ProFTPd FTP Server
# service proftpd start
設定開機時啟動 ProFTPd FTP Server
# chkconfig –level 3 proftpd on
連線測試
# lftp -u test 192.168.1.20
密碼:
lftp test@192.168.1.20:~> ls
ls: 登入錯誤: 530 Login incorrect.
在 /var/log/proftpd/proftpd.log 中找到登入錯誤的記錄
# grep test /var/log/proftpd/proftpd.log
Jan 03 16:17:39 . proftpd[2441] 192.168.1.9 (192.168.1.20[192.168.1.20]): USER test (Login failed): Incorrect password.
但明明密碼是對的,而且改用 vsFTPd FTP Server 就可以正常登入
# service proftpd stop
正在關閉 proftpd: [ 確定 ]
# service vsftpd start
正在啟動 vsftpd 中的 vsftpd: [ 確定 ]
# lftp -u test 192.168.1.20
密碼:
lftp test@192.168.1.20:~> ls -l
-rw-r–r– 1 0 0 358 Jan 03 08:10 groups.sql
-rw-r–r– 1 0 0 563 Jan 03 08:10 users.sql
[@more@]後來在 CentOS 6.x 如何安裝 Proftpd | Vixual 找到了解決的方式
檢查 /var/log/secure 發現有錯誤的訊息
# grep proftpd /var/log/secure | tail -2
Jan 3 16:10:42 proftpd: PAM unable to dlopen(/lib64/security/pam_stack.so): /lib64/security/pam_stack.so: cannot open shared object file: No such file or directory
Jan 3 16:10:42 proftpd: PAM adding faulty module: /lib64/security/pam_stack.so
解決方式:
先備份原檔
# cp /etc/pam.d/proftpd /etc/pam.d/proftpd_$(date +%F)
修改 /etc/pam.d/proftpd
# vim /etc/pam.d/proftpd
把
#%PAM-1.0
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required pam_stack.so service=system-auth
auth required pam_shells.so
account required pam_stack.so service=system-auth
session required pam_stack.so service=system-auth
改成
#%PAM-1.0
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required pam_shells.so
account include password-auth
session required pam_loginuid.so
重新啟動 ProFTPd FTP Server
# service proftpd restart
使用者可以正常登入了!
# lftp -u test 192.168.1.20
密碼:
lftp t0880001@192.168.1.20:~> ls -l
drwx—— 2 test teacher 4096 Jan 3 08:10 .
drwx—— 2 test teacher 4096 Jan 3 08:10 ..
-rw-r–r– 1 test teacher 18 Jul 18 13:19 .bash_logout
-rw-r–r– 1 test teacher 176 Jul 18 13:19 .bash_profile
-rw-r–r– 1 test teacher 124 Jul 18 13:19 .bashrc
-rw-r–r– 1 root root 358 Jan 3 08:10 groups.sql
-rw-r–r– 1 root root 563 Jan 3 08:10 users.sql