Ldap

sssd 不會在 LDAP 中查詢 loginshell

  • May 1, 2022

我已經配置了一個 LDAP 伺服器並創建了一個使用者。ldapsearch 提供以下結果:

# user, People, brave-vesperia.com
dn: uid=masc,ou=People,dc=brave-vesperia,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: masc
cn: user user
sn: user
givenName: ###
title: Dr.
telephoneNumber: #####
mobile: #####
postalAddress: #####
userPassword:: e1NTSEF9QzVQNUp5R2h4NkZzVzRuUzlCZWdlcFlwaVVFWEk0Mno=
labeledURI: #####
loginShell: /bin/bash
uidNumber: 9999
gidNumber: 9999
homeDirectory: /home/masc
description: Admin User

我已經在我的客戶端上配置了 sssd,現在可以使用我的 ldap 帳戶登錄。但是,我得到的外殼是 /bin/sh。

這是我的sssd配置:

[sssd]
config_file_version = 2
services = nss, pam, sudo
domains = brave-vesperia.com

[domain/brave-vesperia.com]
cache_credentials = true
enumerate = true

id_provider = ldap
auth_provider = ldap

ldap_uri = ldap://ldap.brave-vesperia.com
ldap_search_base = dc=brave-vesperia,dc=com
ldap_id_use_start_tls = true
ldap_tls_reqcert = demand
ldap_tls_cacert = /etc/openldap/certs/ca.pem
chpass_provider = ldap
ldap_chpass_uri = ldap://ldap.brave-vesperia.com
entry_cache_timeout = 600
ldap_network_timeout = 2

ldap_schema = rfc2307bis
ldap_group_member = uniqueMember

這是輸出getent masc passwd

masc:*:1001:1001::/home/masc:

/bin/sh不是/bin/bash. 我已經測試了 AlmaLinux 和 Ubuntu 客戶端,因此不太可能與客戶端相關。

搜尋日誌,我反复看到以下幾行:

(2022-04-21  5:35:46): [be[brave-vesperia.com]] [sdap_get_map] (0x0400): Option ldap_user_shell has value loginShell

sssd_brave-vesperia.com.log:(2022-04-21  6:25:50): [be[brave-vesperia.com]] [sysdb_remove_attrs] (0x2000): Removing attribute [loginShell] from [masc@brave-vesperia.com]

我已經解決了這個問題。由於 ldap 端的訪問規則,無法訪問 loginshell 屬性。

引用自:https://unix.stackexchange.com/questions/699483