我正在尝试使用ssh登录远程主机。但是,我发现当我使用命令“ service sshd restart”重新启动ssh时,它将无法重新连接。因此,我重新安装并配置了远程主机,并执行以下相同的操作符:
在service sshd restart
之前:
$ ssh root@106.55.170.166
Last login: Sat Jun 27 10:30:27 2020 from 223.88.133.240
[root@VM_0_17_centos ~]# exit
logout
Connection to 106.55.170.166 closed.
一切都很好。
在service sshd restart
之后:
$ ssh root@106.55.170.166
Last login: Sat Jun 27 10:33:06 2020 from 223.88.133.240
[root@VM_0_17_centos ~]# vim /etc/ssh/sshd_config //reedit this file.
[root@VM_0_17_centos ~]# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@VM_0_17_centos ~]# exit
logout
Connection to 106.55.170.166 closed.
现在,无法重新连接:
$ ssh root@106.55.170.166
ssh: connect to host 106.55.170.166 port 22: Connection refused
==================================
我仅按如下方式编辑sshd_config文件:
Banner /etc/issue