我们有一个 CentOS 7.7 系统,它使用 realmd/sssd 加入 Microsoft AD 域。 Sudo 对于本地系统用户来说确实工作得很好,但是当我们尝试将 sudo 作为 Active Directory 用户 (ocftest) 使用时,我们会收到以下错误:
sudo: PAM account management error: Permission denied
我们使用以下版本的 sudo:sudo-1.8.23-9.el7.x86_64.rpm
用户可以使用其密码完美地“ssh”到系统。经过一番谷歌搜索后,这个问题会出现几次,通常是指将以下内容添加到“/etc/security/access.conf”文件中:
+ : ocftest : ALL
- : ALL : ALL
具有相同名称的用户组(尽管我已经尝试过该用户)存在于“/etc/sudoers.d/salt”文件中:
%[email protected] ALL=(ALL) ALL
只是为了完整性:
cat /etc/pam.d/sudo
#%PAM-1.0
auth include system-auth
account include system-auth
password include system-auth
session optional pam_keyinit.so revoke
session include system-auth
cat /etc/pam.d/sudo-i
#%PAM-1.0
auth include sudo
account include sudo
password include sudo
session optional pam_keyinit.so force revoke
session include sudo
cat /etc/pam.d/password-auth-ac
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth required pam_env.so
auth required pam_faildelay.so delay=2000000
auth [default=1 ignore=ignore success=ok] pam_succeed_if.so uid >= 1000 quiet
auth [default=1 ignore=ignore success=ok] pam_localuser.so
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 1000 quiet_success
auth sufficient pam_sss.so forward_pass
auth sufficient pam_krb5.so use_first_pass
auth required pam_deny.so
account required pam_access.so
account required pam_unix.so broken_shadow
account sufficient pam_localuser.so
account sufficient pam_succeed_if.so uid < 1000 quiet
account [default=bad success=ok user_unknown=ignore] pam_sss.so
account [default=bad success=ok user_unknown=ignore] pam_krb5.so
account required pam_permit.so
password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok
password sufficient pam_sss.so use_authtok
password sufficient pam_krb5.so use_authtok
password required pam_deny.so
session optional pam_keyinit.so revoke
session required pam_limits.so
-session optional pam_systemd.so
session optional pam_oddjob_mkhomedir.so umask=0077
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
session optional pam_sss.so
session optional pam_krb5.so
cat /etc/sssd/sssd.conf
[sssd]
domains = ad.domain.org
config_file_version = 2
services = nss, pam
[domain/ad.domain.org]
ad_domain = ad.domain.org
krb5_realm = AD.DOMAIN.ORG
realmd_tags = manages-system joined-with-samba
cache_credentials = True
id_provider = ad
krb5_store_password_if_offline = True
default_shell = /bin/bash
ldap_id_mapping = True
ignore_group_members = False
use_fully_qualified_names = False
fallback_homedir = /home/%u
access_provider = ad
enumerate = True
dyndns_update = False
auto_private_groups = true
ad_access_filter = (&(memberOf=OU=Users,OU=REDACTED,DC=redacted,DC=org))
[pam]
答案1
尝试在第一次出现后添加no_access_check
到/etc/pam.d/system-auth
(应该是到 的链接)/etc/pam.d/system-auth-ac
account sufficient pam_vas3.so
# cat system-auth-ac
...
account sufficient pam_vas3.so no_access_check
...