Centos7无法使用ssh登陆及解决方案

查看状态:

systemctl status sshd.service

启动服务:

systemctl start sshd.service

重启服务:

systemctl restart sshd.service

开机自启:

systemctl enable sshd.service







今天项目组反映,有一台Centos7服务器无法使用SSH登陆了,所以我就通过本地登陆到该系统后,发现SSH服务没有启动,该判断方法主要是使用的是netstat方法进行查看;

1
netstat  -anlpt |  grep  22

说到这,如果是Centos7的话,我们如果想要使用netstat的命令的话,需要安装net-tools后才可以使用

1
yum instatll net-tools –y    ----安装 netstat 工具

尝试手动启动sshd服务无法启动,提示错误(22端口没有监听)

Centos7无法使用ssh登陆及解决方案_第1张图片

Centos7下ssh没独立log日志,所以在message下

1
Tail –f  /var/log/message      /usr/sbin/ 缺少sshd的文件

Centos7无法使用ssh登陆及解决方案_第2张图片

1
Cd  /usr/sbin/ 下确实没有提示中的sshd文件或者目录

Centos7无法使用ssh登陆及解决方案_第3张图片

所以我们需要重新安装即可

1
yum reinstall openssh-server

clip_image004

安装完成

Centos7无法使用ssh登陆及解决方案_第4张图片

安装后文件有ssh的文件信息

Centos7无法使用ssh登陆及解决方案_第5张图片

重新启动sshd文件即可

1
systemctl start sshd ---启动sshd服务

Centos7无法使用ssh登陆及解决方案_第6张图片





你可能感兴趣的:(Centos7无法使用ssh登陆及解决方案)