CENTOS 升级SSH至8.0P1 用户无法登录Permission denied (publickey,password,keyboard-interactive)

简介: CENTOS 升级SSH至8.0P1 用户无法登录Permission denied (publickey,password,keyboard-interactive)

CENTOS 升级SSH至8.0P1 用户无法登录Permission denied (publickey,password,keyboard-interactive)

问题前奏

有个客户环境的SSH 版本为 OpenSSH_8.0p1, OpenSSL 1.0.2r 26 Feb 2019。且用jsch的0.1.54版本连接出错。为尝试复现问题,先在自己虚拟机上升级环境。

升级步骤参考: https://www.cnblogs.com/nmap/p/10779658.html 。 升级过程无误可用。

问题情况

升级完成后,出现SSH远程登录失败,输入三次密码后报如下错误:

Permission denied (publickey,password,keyboard-interactive).

问题分析解决

[root@gxp5 etc]# service sshd status
● sshd.service - SYSV: OpenSSH server daemon
   Loaded: loaded (/etc/rc.d/init.d/sshd; bad; vendor preset: enabled)
   Active: active (running) since 五 2020-07-17 11:29:50 CST; 33s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 11371 ExecStop=/etc/rc.d/init.d/sshd stop (code=exited, status=0/SUCCESS)
  Process: 11380 ExecStart=/etc/rc.d/init.d/sshd start (code=exited, status=0/SUCCESS)
 Main PID: 11388 (sshd)
    Tasks: 1
   CGroup: /system.slice/sshd.service
           └─11388 /usr/sbin/sshd
7月 17 11:29:50 gxp5 systemd[1]: Starting SYSV: OpenSSH server daemon...
7月 17 11:29:50 gxp5 sshd[11388]: Server listening on 0.0.0.0 port 22.
7月 17 11:29:50 gxp5 sshd[11388]: Server listening on :: port 22.
7月 17 11:29:50 gxp5 sshd[11380]: Starting sshd:[  确定  ]
7月 17 11:29:50 gxp5 systemd[1]: Started SYSV: OpenSSH server daemon.
7月 17 11:30:18 gxp5 sshd[11432]: error: Could not get shadow information for hundsun
7月 17 11:30:18 gxp5 sshd[11432]: Failed password for hundsun from 112.168.136.1 port 54594 ssh2
7月 17 11:30:20 gxp5 sshd[11432]: Failed password for hundsun from 112.168.136.1 port 54594 ssh2
7月 17 11:30:22 gxp5 sshd[11432]: Failed password for hundsun from 112.168.136.1 port 54594 ssh2
  • 可以看到运行状态是正常的,但是登录失败,说是没有影子信息。
  • 查看shadow information的问题
    这里提到了UsePAM 选项变成了 no ,原来是yes 。 https://blog.csdn.net/weixin_30624825/article/details/99312372
    我查看了一下我的/etc/ssh/sshd_config配置文件中,它是注释的,如下:
#UsePAM no
  • 既然是注释的,我也不知道这个版本他的默认值是什么,那么我就改成yes试试,结果问题就解决了,远程可以登录了。

UsePAM

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
  • 机器翻译
#将此设置为‘yes’,以启用PAM身份验证、帐户处理、和会话处理。如果启用了此功能,则PAM身份验证将通过挑战者esponseauthentication和# PasswordAuthentication被允许。根据您的PAM配置,通过挑战者esponseauthentication进行的PAM身份验证可以绕过“PermitRootLogin without-password”的设置。如果您只是想让PAM帐户和会话检查在没有 PAM身份验证的情况下运行,那么启用这个功能,但将PasswordAuthentication 和 质询响应身份验证 设置为“no”。

ps: 还不是很懂,先留个纪念

补充:https://developer.aliyun.com/ask/82869?spm=a2c6h.13706215.wenda.35.6f4940ae6pa3P1

这里提到了,如果ulimit参数修改没有生效,问题可能就是没有开启PAM。

目录
相关文章
|
网络安全 开发工具 数据安全/隐私保护
openssh 升级后ssh远程登录报错Permission denied, please try again.
openssh 升级后ssh远程登录报错Permission denied, please try again.
2000 3
|
安全 Linux 网络安全
Linux端的ssh如何升级?
Linux端的ssh如何升级?
1126 59
|
Kubernetes jenkins 网络安全
Jenkins Pipeline 流水线 - 使用代理节点,Remote SSH 对 K8S 进行升级
Jenkins Pipeline 流水线 - 使用代理节点,Remote SSH 对 K8S 进行升级
223 0
|
Shell 网络安全 开发工具
配置SSH时候,Permission denied问题解决方法
配置SSH时候,Permission denied问题解决方法
1043 4
|
Ubuntu Linux 网络安全
SSH 远程登录报错:Permission denied, please try again. 解决办法
SSH 远程登录报错:Permission denied, please try again. 解决办法
5755 0
|
Linux 网络安全
实验:CentOS 7 编译安装最新版 OpenSSH 9.4p1
CentOS7 升级安装 OpenSSH 9.4p1 OpenSSL 3.0.10
2067 1
|
安全 网络安全
配置SSH服务远程连接空闲超时退出时间(包括SSH无法登录、登录缓慢)
配置SSH服务远程连接空闲超时退出时间(包括SSH无法登录、登录缓慢)
809 0
|
3月前
|
Linux 网络安全 Docker
盘古栈云,创建带ssh服务的linux容器
创建带ssh服务的linux容器
321 146
|
6月前
|
监控 Linux 网络安全
FinalShell SSH工具下载,服务器管理,远程桌面加速软件,支持Windows,macOS,Linux
FinalShell是一款国人开发的多平台SSH客户端工具,支持Windows、Mac OS X和Linux系统。它提供一体化服务器管理功能,支持shell和sftp同屏显示,命令自动提示,操作便捷。软件还具备加速功能,提升访问服务器速度,适合普通用户和专业人士使用。
1878 0
|
9月前
|
安全 Linux 网络安全
在Linux(CentOS和AWS)上安装更新的git2的方法并配置github-ssh
经过以上这些步骤,你现在就能在GitHub上顺利往返,如同海洋中的航海者自由驰骋。欢迎你加入码农的世界,享受这编程的乐趣吧!
389 10