重启sshd服务,导致ssh连接不上服务器,经过排查,查看日志发现出现一下错误
代码语言:javascript复制Oct 25 12:59:00 kdgcapp-58-106 sshd[7413]: PAM unable to dlopen(/usr/lib64/security/pam_stack.so): /usr/lib64/security/pam_stack.so: cannot open shared obje... directory
Oct 25 12:59:00 kdgcapp-58-106 sshd[7413]: PAM adding faulty module: /usr/lib64/security/pam_stack.so
解决方法:
代码语言:javascript复制经过排查发现是ssh rpm 升级后会修改/etc/pam.d/sshd 文件,如下:
#%PAM-1.0
auth required pam_stack.so service=system-auth
account required pam_nologin.so
account required pam_stack.so service=system-auth
password required pam_stack.so service=system-auth
session required pam_stack.so service=system-auth
修改为之前的即可。修改后的文件如下:
#%PAM-1.0
auth required pam_sepermit.so
auth include password-auth
account required pam_nologin.so
account include password-auth
password include password-aut
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open env_params
session optional pam_keyinit.so force revoke
session include password-auth