出现如题中的错误,是因为通过 rpm 升级 ssh (参见:Centos7系统升级OpenSSH到openssh-8.*版本的方法)后会覆盖 /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-auth
# 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

然后重启 ssh 服务:

systemctl restart sshd
(adsbygoogle = window.adsbygoogle || []).push({});