允许 ssh AD 身份验证,同时保留少量本地用户

允许 ssh AD 身份验证,同时保留少量本地用户

需要在Linux服务器中使用AD进行用户认证,同时只保留有限的(1-2个)本地用户。AD认证是通过Kerberos进行的。pam.d文件的配置如下

cat /etc/pam.d/password-auth-ssh 

#%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        sufficient    pam_krb5.so try_first_pass 
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        required      pam_deny.so

account     required      pam_unix.so
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3 type=
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so

cat /etc/pam.d/sshd 

#%PAM-1.0
auth       include      password-auth-ssh
account    required     pam_nologin.so
account    include      password-auth-ssh
password   include      password-auth-ssh
session    optional     pam_keyinit.so force revoke
session    include      password-auth-ssh
session    required     pam_loginuid.so

相关内容