我已经为我的电脑配置了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来ssh WSL。
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。
非常感谢!
好吧,我明白问题所在了,WSL2据说使用的是虚拟机。所以WSL的IP和Windows的IP是不同的。在WSL1版中你不会有这个问题.不幸的是,这样每次重启都会改变WSL的IP地址。也有一些解决方法,但我看不懂,所以我把某人博客上的链接参考一下。https:/www.oyohyee.compostnote_wsl2_net(我不知道这个博客能不能解决这个问题,但好像可以)我找到了官方的解决方案。https:/devblogs.microsoft.comcommandlinewhats-new-for-wsl-insiders-preview-build-18945。