Linux 20.04 与 MobaXterm 连接被拒绝问题

Linux 20.04 与 MobaXterm 连接被拒绝问题

我正在尝试使用 SSH 将 Ubuntu Linux 20.04 连接到 MobaXterm。我尝试了所有方法,但 MobaXterm 给出错误“网络错误:连接被拒绝”

我刚刚开始学习Linux,遇到了很多问题,但我没有处理这个。

我的 Linux 出了什么问题?

提前致谢。

SSH

ssh 127.0.0.1

回复

 Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 5.15.0-56-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

0 updates can be applied immediately.

New release '22.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Your Hardware Enablement Stack (HWE) is supported until April 2025.
Last login: Fri Dec 23 23:12:49 2022 from 127.0.0.1
  • 我没发现这里有任何问题。

sudo lsof -i -n -P | grep LISTEN

回复

systemd-r  491 systemd-resolve   13u  IPv4  19124      0t0  TCP 127.0.0.53:53 (LISTEN)
cupsd      568            root    6u  IPv6  22865      0t0  TCP [::1]:631 (LISTEN)
cupsd      568            root    7u  IPv4  22866      0t0  TCP 127.0.0.1:631 (LISTEN)
sshd       687            root    3u  IPv4  25177      0t0  TCP *:22 (LISTEN)
sshd       687            root    4u  IPv6  25179      0t0  TCP *:22 (LISTEN)

Ssh 状态

systemctl status sshd

回复

* ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-12-23 23:18:05 +03; 17min ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 674 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
   Main PID: 687 (sshd)
      Tasks: 1 (limit: 18658)
     Memory: 7.3M
     CGroup: /system.slice/ssh.service
             `-687 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

Warning: some journal files were not opened due to insufficient permissions.

本地端口

ss -plnt
State              Recv-Q             Send-Q                         Local Address:Port                           Peer Address:Port             Process             
LISTEN             0                  4096                           127.0.0.53%lo:53                                  0.0.0.0:*                                    
LISTEN             0                  128                                  0.0.0.0:22                                  0.0.0.0:*                                    
LISTEN             0                  5                                  127.0.0.1:631                                 0.0.0.0:*                                    
LISTEN             0                  128                                     [::]:22                                     [::]:*                                    
LISTEN             0                  5                                      [::1]:631                                    [::]:*          

联合国基金会地位

sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere                  
22                         ALLOW       Anywhere                  
2222/tcp                   ALLOW       Anywhere                  
22/tcp (v6)                ALLOW       Anywhere (v6)             
22 (v6)                    ALLOW       Anywhere (v6)             
2222/tcp (v6)              ALLOW       Anywhere (v6)

ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.031 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.056 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.040 ms

MobaXterm 连接问题

MobaXterm 连接问题

答案1

我通过在 MobaXterm 中编辑我的 WSL 会话并将“运行方法”从“本地主机连接”更改为“自动检测”来解决这个问题。

相关内容