Xshell 连接本地的Linux 系统,提示:Could not connect to '192.168.182.128' (port 23): Connection failed

Xshell 在连接本地Linux 系统失败:

1.先检查是否是使用的ssh 连接:

Xshell 连接本地的Linux 系统,提示:Could not connect to '192.168.182.128' (port 23): Connection failed

2.输入 ping Linux 的ip 如果是可以ping 通的,说明是网络没有问题,再次进行连接,如果依然是连接失败

Xshell 连接本地的Linux 系统,提示:Could not connect to '192.168.182.128' (port 23): Connection failed

3. 先查看防火墙的状态,在vmware Linux 系统终端 中输入 service iptables status /service  firewalld status 

Xshell 连接本地的Linux 系统,提示:Could not connect to '192.168.182.128' (port 23): Connection failed

如果防火墙是开启的,有可能是防火墙阻止了,先关闭防火墙,输入service iptables stop  ,由于CentOs 7之后防火墙改成了firewalld,所以如果第一个不成功的话,就输入 service firewalld stop  。注意:这个防火墙是重启后就复原的,如果想永久生效,输入  开启:chkconfig iptables/firewalld on  关闭:chkconfig iptables/firewalld off .设置后重启 : reboot

Xshell 连接本地的Linux 系统,提示:Could not connect to '192.168.182.128' (port 23): Connection failed

4.完成后再次连接,如果依然报错,可能是22 端口没有开

输入 ss -lnt (小写的L)发现没有开启 22 端口

Xshell 连接本地的Linux 系统,提示:Could not connect to '192.168.182.128' (port 23): Connection failed

开启 ssh 服务,输入 service sshd start ,再次运行 ss -lnt,查看是否已经打开

Xshell 连接本地的Linux 系统,提示:Could not connect to '192.168.182.128' (port 23): Connection failed

SSH服务开机自动启动:chkconfigsshd on

取消开机自启动:chkconfig sshd off

开启服务后,检查服务状态:service sshd status