我想使用 LDAP 登录我的 FTP。使用 conf 文件:
<IfModule mod_ldap.c>
LDAPLog /var/log/proftpd/ldap.log
LDAPProtocolVersion 3
DebugLevel 3
LDAPAuthBinds on
LDAPServer ldap://localhost
LDAPBindDN "cn=admin,dc=example,dc=com" "pass"
LDAPUsers "ou=example.com,ou=Domains,dc=example,dc=com" "(uid=%u)"
LDAPSearchScope subtree
LDAPGenerateHomedir off
LDAPGenerateHomedirPrefix /var/mediaserver
</IfModule>
使用用户 user2 登录
# user2, example.com, Domains, example.com
dn: uid=user2,ou=example.com,ou=Domains,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: top
objectClass: qmailUser
cn: yann example
mail: [email protected]
sn: Gailard
qmailGID: 5000
qmailUID: 5000
uid: user2
userPassword:: e1NTSEF9NXJNTS8zZjhLaTEzSXlhckdUdHd6aWVvVHU3S01nd2M=
mailMessageStore: /var/vmail/example.com/user2/
日志说
2020-08-22 17:53:15,397 mod_ldap/2.9.4[42030]: generated filter ou=example.com,ou=Domains,dc=example,dc=com from template ou=example.com,ou=Domains,dc=example,dc=com and value user2
2020-08-22 17:53:15,397 mod_ldap/2.9.4[42030]: generated filter (uid=user2) from template (uid=%u) and value user2
2020-08-22 17:53:15,398 mod_ldap/2.9.4[42030]: attempting connection to URL ldap://localhost
2020-08-22 17:53:15,398 mod_ldap/2.9.4[42030]: set LDAP protocol version to 3
2020-08-22 17:53:15,398 mod_ldap/2.9.4[42030]: connected to URL ldap://localhost
2020-08-22 17:53:15,400 mod_ldap/2.9.4[42030]: successfully bound as DN 'cn=admin,dc=example,dc=com' with password (see config)
2020-08-22 17:53:15,400 mod_ldap/2.9.4[42030]: set dereferencing to 0
2020-08-22 17:53:15,400 mod_ldap/2.9.4[42030]: set query timeout to 5 secs
2020-08-22 17:53:15,400 mod_ldap/2.9.4[42030]: searched under base DN ou=example.com,ou=Domains,dc=example,dc=com using filter (uid=user2)
2020-08-22 17:53:15,400 mod_ldap/2.9.4[42030]: no entries for filter (uid=user2) under base DN ou=example.com,ou=Domains,dc=example,dc=com
2020-08-22 17:53:19,361 mod_ldap/2.9.4[42030]: connection successfully unbound
2020-08-22 17:53:19,362 mod_ldap/2.9.4[42030]: not unbinding to an already unbound connection
我真的不知道为什么 proftp 找不到用户 2。我使用的是 CentOS7
答案1
问题与日志记录所说的完全不同。激活SystemLog /var/log/proftpd/proftpd.log
适当的日志记录问题。我停用 unix 和 pam 身份验证,只允许 ldap 身份验证。