ssh升级OpenSSH_8.5p1密码输入正确仍然无法登录已解决

ssh配置文件需要开启:

PermitRootLogin yes #限制root用户登录,如果使用的是root用户,那么就需要打开
PubkeyAuthentication yes #打开秘钥验证
PasswordAuthentication yes #打开密码验证

源码安装的ssh,sshd等文件,需要复制到/usr/bin下,sshd需要/usr/sbin下

/etc/pam.d/sshd文件必须存在,不存在就无法通过验证(本人这次就因为这个文件丢了,所以失败。),还需要安装pam,pam-devel,正常来说系统会自带的,如果卸载了,那么有/etc/pam.d/sshd也不会生效,还是会登录不上去,会提示这样的情况

centos7下的/etc/pam.d/sshd文件内容:

#########################以下内容#########################

#%PAM-1.0
auth required pam_sepermit.so
auth substack password-auth
auth include postlogin
# Used with polkit to reauthorize users in remote sessions
-auth optional pam_reauthorize.so prepare
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 required pam_namespace.so
session optional pam_keyinit.so force revoke
session include password-auth
session include postlogin
# Used with polkit to reauthorize users in remote sessions
-session optional pam_reauthorize.so prepare

#########################以上内容#########################

centos6下的/etc/pam.d/sshd文件内容:

#########################以下内容#########################

auth required pam_sepermit.so
auth required pam_tally2.so deny=3 unlock_time=86400 even_deny_root root_unlock_time=600
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

#########################以上内容#########################

 

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享
评论 抢沙发