我的阿里云服务器今天突然连接不上
在xshel连接报错:
Connecting to 39.100.144.30:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Socket error Event: 32 Error: 10053.
Connection closing...Socket close.
Connection closed by foreign host.
Disconnected from remote host(39.100.144.30) at 09:55:41.
Type `help' to learn how to use Xshell prompt.
在终端登录查看信息
# service sshd status
sshd[7794]: Failed password for invalid user admin from 45.224.105.95 port 42423 ssh2
sshd[10205]: Invalid user sniffer from 123.21.253.168 port 60809
sshd[10205]: error: Could not get shadow information for NOUSER
sshd[10205]: Failed password for invalid user sniffer from 123.21.253.168 port 60809 ssh2
sshd[24284]: Invalid user admina from 14.187.177.87 port 56323
sshd[24284]: error: Could not get shadow information for NOUSER
sshd[24284]: Failed password for invalid user admina from 14.187.177.87 port 56323 ssh2
sshd[25822]: Accepted password for root from 47.96.60.110 port 2099 ssh2
sshd[25827]: Accepted password for root from 47.96.60.213 port 37498 ssh2
sshd[25847]: Accepted password for root from 47.96.60.214 port 14030 ssh2
查看日志
# cat /var/log/messages |grep error
sshd[598]: error: kex_exchange_identification: Connection closed by remote host
sshd[2747]: error: kex_exchange_identification: Connection closed by remote host
sshd[27038]: error: kex_exchange_identification: Connection closed by remote host
sshd[7787]: error: Could not get shadow information for NOUSER
sshd[7794]: error: Could not get shadow information for NOUSER
sshd[29152]: error: kex_exchange_identification: Connection closed by remote host
sshd[10205]: error: Could not get shadow information for NOUSER
sshd[11128]: error: kex_exchange_identification: read: Connection reset by peer
sshd[12179]: error: kex_exchange_identification: Connection closed by remote host
sshd[23249]: error: kex_exchange_identification: Connection closed by remote host
sshd[24281]: error: kex_exchange_identification: Connection closed by remote host
sshd[24284]: error: Could not get shadow information for NOUSER
sshd[25067]: error: kex_exchange_identification: Connection closed by remote host
sshd[25076]: error: kex_exchange_identification: Connection closed by remote host
sshd[26628]: error: kex_exchange_identification: Connection closed by remote host
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
最后查出是网络的问题。连接手机热点就可以登录服务器。【抓狂】
中间鬼使神差的,重启sshd服务,重启服务器,重置密码导致在云控制台登录时出现以下情况
解决:/etc/ssh/sshd_config配置文件中 #UsePAM no 参数去掉 #号 ,重启sshd服务后好了,
好在ssh不能连接时,还可以用VNC连接。
之后为了确认是否是这个参数影响的,做好快照后,又把参数 #UsePAM no 的#号加上了,重启sshd服务后,依旧可以用ssh方式登录,此时我就有些摸不着头脑了????????????????????????????????????
UsePAM是的openssh中的一个pam证书验证模块,默认是启用的
网上有些是因为启用了pam导致登录失败
有些是因为没有启用登录失败
不懂啊!!!全网 唯一 一篇对于PAM的介绍 《保护ssh的三把锁》【反正公子这么认为】
- 总结检查思路
1、更换网络再次登录测试【强烈推荐首先尝试】
2、selinux机制是否关闭【确认已经关闭】
3、检查/etc/ssh/sshd_config配置文件中 #UsePAM no