MobaXterm连接服务器:Network error: Connection refused

  • Post author:
  • Post category:其他



centos7:

问题:连接本地虚拟机时,连接不上,报错--Network error: Connection refused
原因:
1.刚开始直接ping主机,是可以ping通的,说明网络是正常的
[root@szb ~]# ping 192.168.8.132
PING 192.168.8.132 (192.168.8.132) 56(84) bytes of data.
64 bytes from 192.168.8.132: icmp_seq=1 ttl=64 time=0.969 ms
64 bytes from 192.168.8.132: icmp_seq=2 ttl=64 time=4.00 ms

2.查询sshd安装了没,说明是存在的
[ly@192 ~]$ ps -e |grep ssh
  8245 ?        00:00:00 ssh-agent
  
3.ss -ntl 查询22端口是否开启,此处没有22端口
[ly@192 ~]$ ss -ntl
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port         
LISTEN     0      5      192.168.122.1:53                       *:*                  
LISTEN     0      128    127.0.0.1:631                      *:*                  
LISTEN     0      128      [::1]:631                   [::]:*                  
解决办法:确认一下是否还是默认的端口,vim /etc/ssh/sshd_config,显示没有被修改

4.重启sshd服务,在查看端口,已经存在22端口了,MobaXterm软件重连接,可以了
systemctl restart sshd


ubuntu20.04

报错:root@192.168.8.141's password:
Access denied

排查路径:
1.查看sshd相关服务是否存在
apt-get install openssh-server
systemctl restart ssh     # 重启 openssh server

2.查看22端口是否存在
ss -ntl

3.将密码拒绝远程访问改一下配置
root@ubuntu:~# vim /etc/ssh/sshd_config 
#PermitRootLogin prohibit-password
改为
PermitRootLogin yes
systemctl restart ssh



版权声明:本文为szb521原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。