ssh登录虚拟机上的linux

环境

windows10

xshell

VMware

出错表现:

[c:~]$ ssh 192.168.31.221

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

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

分析处理:

1. ping测试 :

linux--》windows10  ok

windows10--》linux ok

2.linux ssh服务状态查询

sudo service ssh status

显示ssh正在running

3.查询可能的原因

3.1关闭windows10 防火墙

3.2 检测linux 防火墙

sudo ufw status

sudo ufw disable  

上面问题都排除了,都没有问题

4.检测linux配置信息

gedit /etc/ssh/sshd_config

在其文件里找到并修改为:PasswordAuthentication yes , PermitRootLogin yes两行即可

5.重启ssh服务

sudo service ssh restart

6.再次连接----》OK

参考文档:

https://www.cnblogs.com/zxdhxxzj/p/6923024.html     这个的ps -e没有用到

https://www.cnblogs.com/zxf100/archive/2017/05/09/6832671.html    这个参考配置

其他信息,

电脑笔记本,无线网卡,VMware 中linux是使用桥接方式,用wireless方式连接的

原文地址:https://www.cnblogs.com/billhsu2009/p/7847035.html