Centos7 SSH服务启动时报“main process exited, code=exited”status 255错误

Linux 221℃

故障现象:服务器强制关机更换了内存,启动后,ssh无法连接服务器

1、怀疑是路由问题

使用KVM连接服务器,查看路由

[localhost1 ~]$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gateway         0.0.0.0         UG    0      0        0 bond2
10.136.200.0    0.0.0.0         255.255.255.0   U     0      0        0 bond2
10.136.202.0    172.18.1.254    255.255.255.0   UG    0      0        0 bond1
10.136.204.0    0.0.0.0         255.255.255.0   U     0      0        0 bond0

可以看到路由没有问题,而且在同网段服务器ping该服务器,也是通的

[localhost2 ~]$ ping 10.136.200.45
PING 10.136.200.45 (10.136.200.45) 56(84) bytes of data.
64 bytes from 10.136.200.45: icmp_seq=1 ttl=64 time=0.120 ms
64 bytes from 10.136.200.45: icmp_seq=2 ttl=64 time=0.119 ms

2、怀疑是sshd服务问题

在同网段服务器测试ssh该服务器果然不通

[localhost2~]$ ssh root@10.136.200.45
ssh: connect to host 10.136.200.45 port 22: Connection refused

3、确定是sshd服务异常

使用KVM连接服务器,查看sshd

systemctl status sshd
#发现状态是activing,正常应该是active (running)
#发现报错main process exited, code=exited”status 255

4、解决问题

冲浪后得知可能是服务器不正常关机导致,建议重新安装openssh-server快速解决
搭建好yum源,可以是光盘镜像yum,也可以是网络yum

#卸载openssh-server
rpm -e openssh-server
#安装openssh-server
yum install openssh-server -y

转载请注明:零五宝典 » Centos7 SSH服务启动时报“main process exited, code=exited”status 255错误