xshell连接虚拟机ubuntu

在ubuntu界面,打开终端terminal,输入:

ifconfig

出现如下界面:

fb993608316@ubuntu:/$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:f7:2d:bf  
          inet addr:192.168.204.128  Bcast:192.168.204.255  Mask:255.255.255.0

然后打开xshell:

点击连接:

Connecting to 192.168.204.128:22...
Could not connect to '192.168.204.128' (port 22): Connection failed.

Type `help' to learn how to use Xshell prompt.

这可能是因为没有安装openssh-server,执行以下代码:

sudo apt-get install openssh-server 

之后通过以下命令查看SSH是否启动: 

ps -e | grep ssh 

出现如下界面:

fb993608316@ubuntu:/$  ps -e|grep ssh
 2133 ?        00:00:00 ssh-agent
 5013 ?        00:00:00 sshd

完成上述这些操作后,再次使用XShell连接虚拟机,这时又弹出这个:

输入用户名即可!其次又出现以下界面!

 

最后XShell虚拟机的界面出现:

 连接成功!!!

猜你喜欢

转载自www.cnblogs.com/ConnorShip/p/10259582.html