【问题标题】:Clion and cmd ssh WSL are refused on windows 10Windows 10 上拒绝 Clion 和 cmd ssh WSL
【发布时间】:2020-06-02 11:51:47
【问题描述】:

我已经为我的电脑配置了 WSL,它在 WSL 终端中成功运行。

zoom@Zoom:/etc/ssh$ ssh zoom@localhost -p 2222
zoom@localhost's password:
Welcome to Ubuntu 20.04 LTS (GNU/Linux 4.19.104-microsoft-standard x86_64)

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

  System information as of Tue Jun  2 19:42:24 CST 2020

  System load:  0.0                Processes:             16
  Usage of /:   0.9% of 250.98GB   Users logged in:       0
  Memory usage: 1%                 IPv4 address for eth0: myIpAddress
  Swap usage:   0%


0 updates can be installed immediately.
0 of these updates are security updates.


Last login: Tue Jun  2 19:33:21 2020 from 127.0.0.1

但是,我无法使用 cmd 或 Clion 对 WSL 进行 ssh。

CMD:
C:\Users\Zoom>ssh zoom@localhost -p 2222
ssh: connect to host localhost port 2222: Connection refused

Clion ssh
I get this error
Can't connect to remote host: Connection refused: connect

我已尽力寻找解决方案。但是没有解决办法

这是关于我的 sshd_config 文件的一些信息:

ListenAddress 0.0.0.0
Port 2222
UsePrivilegeSeparation no
PasswordAuthentication yes
AllowUsers zoom

我真的很想知道如何解决它。

我的 Windos 版本是 2004 (os build 19635.1)。

WSL 版本为 2。

WSL 系统是 ubuntu-20.04

非常感谢!

【问题讨论】:

  • 另一种解决方案可能是在几个单独的磁盘分区上安装一个良好的最新 Linux 发行版(例如 DebianUbuntu .... )。在启动时,您将在 Windows(用于游戏)和 Linux(用于其他一切)之间进行选择。或者在虚拟机中运行它们。

标签: linux windows clion windows-subsystem-for-linux


【解决方案1】:

好的,我看到了问题。 据说 WSL2 使用虚拟机。所以 WSL 中的 IP 与 Windows 中的 IP 不同。在 WSL 版本 1 中您不会遇到此问题。 不幸的是,这会在您每次重新启动时更改 WSL 的 IP 地址。也有一些解决方法但是看不懂,所以我把某人博客的链接引用用中文放上去:https://www.oyohyee.com/post/note_wsl2_net (不知道这个博客能不能解决问题,但好像可以) 我找到了官方解决方案:https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-insiders-preview-build-18945/

【讨论】:

    【解决方案2】:

    以我为例,问题描述中的配置完成后,重启WSL中的SSH服务,然后重启WSL2中具体的ubuntu发行版帮助。

    p.s.:重启电脑对我不起作用。

    【讨论】:

    • 这并不能真正回答问题。如果您有其他问题,可以点击 进行提问。要在此问题有新答案时收到通知,您可以follow this question。一旦你有足够的reputation,你也可以add a bounty 来引起对这个问题的更多关注。 - From Review
    猜你喜欢
    • 1970-01-01
    • 2018-08-27
    • 2022-07-21
    • 1970-01-01
    • 2021-02-10
    • 1970-01-01
    • 1970-01-01
    • 2019-06-21
    • 1970-01-01
    相关资源
    最近更新 更多