WSL: [wsl2] can't use ssh
in wsl2 when I use ssh to login a remote server, the connection closed immediately. I change the distro to v1, the connection can establish.
when use git (with ssh-key) to push file to github, it fail too. it says:
Received disconnect from 13.250.177.223 port 22:11: Bye Bye
Disconnected from 13.250.177.223 port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17
Well let’s be clear - no. No bug has been identified here. But happy to hear you are unblocked.
Just installed WSL2, and I also can’t SSH to any of my servers. Rolling back to WSL1
I just upgraded to WSL2 along with latest Windows 10, 2020 and I cannot ssh to any of our servers now. I have to go to the cmd or powershell it’s a bummer. I was excited about WSL2.
Because that paragraph has nothing to do with your OP. Git push to github works in WSL2 regardless of whether “you will need to access any Linux server from Windows using the IP address of your Linux distro”.
The word “identified” is important here. That you cannot push to Github does not identify a bug. Indeed, the scope for bugs has shrunken considerably in WSL2 (vs. WSL1) because you’d have to conclude you found something new and novel wrong with either (a) Hyper-V or (b) the Linux kernel.
The reason for your “
fatal: Could not read from remote repository” is, to be clear, neither of those things. Whatever the reason may be. And so the obv isn’t lost:git pushWSL2 to github works. That you’ve decided to use Windows OpenSSH instead, for whatever reasons, is fine also; that works too. The cap below is superfluous. If “[wsl2] can’t use ssh” were a bug, you’d know from the screeching.Encountered the same issue at WSL2, but after digging further I have a workaround here. Try to explicitly specify ciphers at /etc/ssh/ssh_config, or run
ssh -oCiphers=your_ciphers username@domain. It works for me. NEED TO KEEP THE CIPHER STRING SHORTUpdate: I looked up the journals of ssh.service on the other side and got the following message:
error: kex_input_kexinit: discard proposal: string is too large [preauth]It seems to be a issue of OpenSSH Client or the network part of Linux kernel.(TBH, I don’t know how it works, so it might be wrong)Update: New issue opened. For details see #5244.
Now I know that the issue should be blamed to the too-large preauth string, and explicitly config ciphers might be a workaround.