故障现象:业务反馈一台虚拟机无法登陆,早晨还好好的
报错信息:
[root@TENCENT64 ~]# ssh 10.12.141.111
Connection closed by 10.12.141.111
没有台明显的报错,然后-v
[root@TENCENT64 ~]# ssh -v 10.12.141.111
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 10.12.141.111 [10.12.141.111] port 36000.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 10.12.141.111
解决过程:公司对每台机器都有VNC,要想解决故障,首先要登录系统,VNC发现,账号密码都是对的,就是无法登录。百思不得其解。
1:VNC登录,账户无效,由于VNC有延迟,不能直接进单用户。
2:kpartx -av 故障机器的系统盘,将系统盘挂载到母机的/mnt目录。
3:cat /mnt/etc/ssh/sshd_config发现没有异常
4:找google大神,看了些国外文档,很多国外的文章报错后还有一些关于认证的信息。突然想到了之前处理的一个故障。
5:ll /mnt/etc/ssh/发现这个文件夹下的所有文件权限
[root@node- /mnt]# ll etc/ssh/
total 156
-rwxrwxrwx 1 root root 125811 Dec 20 2012 moduli
-rwxrwxrwx 1 root root 2050 Mar 24 2014 ssh_config
-rwxrwxrwx 1 root root 668 Dec 26 2014 ssh_host_dsa_key
-rwxrwxrwx 1 root root 590 Dec 26 2014 ssh_host_dsa_key.pub
-rwxrwxrwx 1 root root 1675 Dec 26 2014 ssh_host_rsa_key
-rwxrwxrwx 1 root root 382 Dec 26 2014 ssh_host_rsa_key.pub
-rwxrwxrwx 1 root root 3911 Mar 24 2014 sshd_config
-rwxrwxrwx 1 root root 3911 Mar 24 2014 sshd_config.l
6:开一台正常的机器,查看这些文件的权限设置
7:将所有文件和/etc/ssh目录的权限都改为正常的
[root@TENCENT64 ~]# ll /etc/ssh/
total 156
-rw------- 1 root root 125811 Jun 12 2014 moduli
-rw-r--r-- 1 root root 2048 Nov 17 2015 ssh_config
-rw------- 1 root root 668 May 11 2015 ssh_host_dsa_key
-rw-r--r-- 1 root root 590 May 11 2015 ssh_host_dsa_key.pub
-rw------- 1 root root 1675 May 11 2015 ssh_host_rsa_key
-rw-r--r-- 1 root root 382 May 11 2015 ssh_host_rsa_key.pub
-rw------- 1 root root 3877 Nov 17 2015 sshd_config
-rw------- 1 root root 3873 May 12 2015 sshd_config.l
8:卸载/mnt/,kpartx -dv 复原系统盘
9:启动虚拟机,登录成功。