欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.

程序员文章站 2022-05-01 14:46:05
...

Could not connect to ‘IP’ (port 22): Connection failed.

xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.

发生这种情况我的解决方法有三个

第一种情况:查看你相关的VMware服务有没有开

xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.

步骤:
右键桌面下方的任务栏——>任务管理器——>服务——>找到下图VMware的两个服务——>右键“已停止”选择“开始”进行开启

xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
开启后:
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.

第二种情况:那你就看看有没有开启ssh服务,没有就开启或者是你没安装就安装个ssh远程服务。

由于xshell远程连接ubuntu是通过ssh协议的,所以,需要给ubuntu安装ssh服务器。

1、查看ssh是否启动,有sshd说明已经启动
命令:

//查看ssh是否启动,有sshd说明已经启动
sudo ps -e |grep ssh
//启动ssh
sudo service ssh start

没有安装ssh服务时,会显示
Failed to start ssh.service:Unit ssh.service not found.

2、要是没有安装ssh就安装
ubuntu安装ssh服务器命令:

// 更新软件包
sudo apt-get update
//安装ssh
sudo apt-get install openssh-server;

第三种:查看是否是Ubuntu里面的IP和Windows10上对应的网络连接的IP不符

在Ubuntu上查看
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
在Windows10上查看
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.
xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.

能看到Ubuntu上的IP是192.168.45.0,而Windows10上是192.168.45.1,要知道子网IP是可以从0~225的,所以这两IP是一样的

最后!!!!
连接成功!!!!!!可喜可贺!!!!!

xshell中连接Ubuntu出现错误:Could not connect to ‘IP‘ (port 22): Connection failed.