求助,阿里云上的 CentOS 6.5,无法使用 Linux 的 ssh 登陆

2019-06-20 17:42:55 +08:00
 beiwei2008

阿里云上的 CentOS 6.5,无法使用 Linux 的 ssh 登陆

使用用户名,密码的方式登陆

window 使用 XShell,SecureCRT 都可以,Putty 不行

用 Linux 的 ssh 命令返回 closed by remote host

客户端 debug 模式看到应该是通过验证了

服务器登陆日志显示: pam_setcred():Permission denied

3389 次点击
所在节点    Linux
15 条回复
busex1
2019-06-20 17:55:04 +08:00
检查下密钥问题
beiwei2008
2019-06-20 17:57:32 +08:00
@busex1 什么密钥,使用用户名+密码登录
kiwier
2019-06-20 17:58:34 +08:00
不要用 root 登录
beiwei2008
2019-06-20 18:01:17 +08:00
@kiwier 现在只有一个 root 账户,我是临时维护下,不想再加用户名,另外,这个情况和使用 root 账户有关系么?
kiwier
2019-06-20 18:09:02 +08:00
@beiwei2008 去阿里云登录控制台进去,改一下配置
kiwier
2019-06-20 18:10:52 +08:00
@beiwei2008 默认系统不让用 root 用户 ssh 登录
Cu635
2019-06-20 18:25:48 +08:00
@kiwier
那么 lz “ window 使用 XShell,SecureCRT 都可以”这又是怎么回事?
CivAx
2019-06-20 18:26:17 +08:00
既然提示 pam_setcred() ,那就检查你的 PAM 鉴权设定,比如是否禁止了登录多个 ROOT 用户等
kiwier
2019-06-20 18:33:13 +08:00
@Cu635 这俩是 ssh 客户端
kiwier
2019-06-20 18:33:28 +08:00
@CivAx 正解
beiwei2008
2019-06-20 18:35:05 +08:00
@kiwier 现在 windows 客户端正常,还需要调整服务端么?
expy
2019-06-20 18:36:03 +08:00
openssh 可以加上 vvv 选项,查看客服端的日志。
beiwei2008
2019-06-20 19:04:37 +08:00
@expy

这是客户的 ssh 日志:

debug1: Next authentication method: keyboard-interactive
Password:
debug1: Authentication succeeded (keyboard-interactive).
Authenticated to XXX.XXX.XXX.XXX(server_IP) ([XXX.XXX.XXX.XXX(server_IP)]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: channel 0: free: client-session, nchannels 1
Connection to XXX.XXX.XXX.XXX(server_IP) closed by remote host.
Connection to XXX.XXX.XXX.XXX(server_IP) closed.
Transferred: sent 2304, received 2448 bytes, in 0.0 seconds
Bytes per second: sent 944640.9, received 1003681.0
debug1: Exit status -1
beiwei2008
2019-06-20 19:16:32 +08:00
@CivAx 其他地方 root 账户都退出 Linux 依旧登陆不进去,window 客户端一直正常
beiwei2008
2019-06-20 19:48:57 +08:00
搞定了,客户端 ssh 需要配置 preferredauthentications 属性,设置为 password,window 客户端默认就是 password,所以没有问题,Linux 客户端默认是 keyboard-interactive,有兴趣的可以查查 ssh 的认证方式,如果是密钥认证应该没这么多麻烦事

:-(,折腾了一天~~~

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/575921

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX