
希望大家都做好事。
讓我來說明一下,我已經設定了 LDAP 伺服器和客戶端計算機
伺服器工作完美,在從客戶端電腦進行搜尋時,它也從 LDAP 伺服器取得查詢,但是當我切換使用者時,它說使用者不存在
[root@ldapc ~]# su - babin
su: user babin does not exist
我已經從客戶端機器嘗試過這個,我得到了以下答复
# ldapsearch -x -b dc=tecmintlocal,dc=com -h ldap.tecmintlocal.com
# extended LDIF
#
# LDAPv3
# base <dc=tecmintlocal,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# tecmintlocal.com
dn: dc=tecmintlocal,dc=com
dc: tecmintlocal
objectClass: top
objectClass: domain
# People, tecmintlocal.com
dn: ou=People,dc=tecmintlocal,dc=com
ou: People
objectClass: top
objectClass: organizationalUnit
# Group, tecmintlocal.com
dn: ou=Group,dc=tecmintlocal,dc=com
ou: Group
objectClass: top
objectClass: organizationalUnit
# tecmint_gp1, Group, tecmintlocal.com
dn: cn=tecmint_gp1,ou=Group,dc=tecmintlocal,dc=com
objectClass: posixGroup
objectClass: top
cn: tecmint_gp1
userPassword:: YWRtaW4xMjMk
gidNumber: 20000
# babin, People, tecmintlocal.com
dn: uid=babin,ou=People,dc=tecmintlocal,dc=com
uid: babin
cn: babin babin
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword:: YWRtaW4xMjMk
shadowLastChange: 16120
shadowMin: 0
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 2000
gidNumber: 20000
homeDirectory: /home/babin
# tecmintclient, People, tecmintlocal.com
dn: uid=tecmintclient,ou=People,dc=tecmintlocal,dc=com
uid: tecmintclient
cn: tecmintclient tecmintclient
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword:: YWRtaW4xMjMk
shadowLastChange: 16120
shadowMin: 0
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 2000
gidNumber: 20000
homeDirectory: /home/tecmintclient
# search result
search: 2
result: 0 Success
# numResponses: 7
# numEntries: 6
答案1
你是否真的配置好的系統從 LDAP 檢索使用者帳號?
為此,您通常需要安裝一個 LDAP 用戶端,例如nslcd
(又稱 nss-pam-ldapd),它將附帶一個要新增的 NSS 模組/etc/nsswitch.conf
(告訴系統使用 LDAP 用戶端來取得使用者資訊)。
(您還需要添加一個 PAM 模組,用於在登入時檢查使用者密碼;它pam_ldap
也可以,或者更安全的東西,例如pam_krb5
。)
如果您已經安裝了 LDAP 用戶端,請先確保它配置了正確的「基本 DN」(搜尋位置),然後尋找各種日誌記錄/偵錯選項。
tshark -n -Y ldap -VO ldap
也可以使用 Wireshark :檢查 LDAP 流量以查看實際執行的搜尋。