-
Notifications
You must be signed in to change notification settings - Fork 856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSH can‘t Connect to WSL2 from another machine #9059
Comments
Thank you for reporting this @awohaoa. Unfortunately, this is a known limitation of store WSL. At the moment it's not possible to access wsl from session 0 (which is where the Windows OpenSSH server run). |
@OneBlue |
This has actually been "broken" (a.k.a. a known limitation) in every Store release since they first started doing them back in October of last year with 0.47.1.0 and was noted in the initial Devblog announcement. I just uninstall 0.70.5 to test, since you said 0.66.2 was working.
Is it possible that you didn't actually have 0.66.2 installed when it was working? You might want to retest yourself -- It's quite easy to switch around versions at will without even needing to reboot. Just make sure you verify the release with
Dang, I sure hope so -- This was an incredibly useful capability, and WSL feels a bit hampered without it. I've been assuming this is a Windows limitation with the way that Store apps are launched, which had me thinking that Windows 11 22H2 would provide a solution for it. But alas, no -- It's still not working on 22H2. |
+1, it's strange that we take one step forward and one step back. |
@NotTheDr01ds How do you switch around versions? The --rollback option doesn't seem to exist anymore. If I uninstall and then reinstall a different version of WSL2, will my existing distributions be deleted? |
As a workaround for now it is possible to install and run a second OpenSSH server (using a different port) in your WSL instance. This can then be combined with using the Host openssh_win32
Hostname your_computer.local
User windows_username
Host openssh_wsl
ProxyJump openssh_win32
User wsl_username
HostName localhost
Port 2222 The above example assumes that the second OpenSSH server in wsl is running on port 2222. Using this configuration it is then possible to connect to the wsl instance via the hostname ssh openssh_wsl As always, YMMV. |
Does joes work around only work if have WSL instance already running? |
It would require the wsl instance to be running prior to connecting to it. This workaround would not be able to start the wsl instance. |
Agreed - I posted that technique on Super User a bit over a year ago, and yes, jumphosts are super useful for WSL, especially when I was using Ansible to configure WSL distributions over SSH. It was a whole lot more useful when you could also start the WSL instance remotely, especially since I have typically have somewhere upwards of 12 distributions installed. ;-) |
Launching a instance of WSL remotely worked previously and was very convenient. Bascily, you would have the Windows Open SSH instance running and then you could jump into a WSL instance from there. |
Is there any update on this? |
1 similar comment
Is there any update on this? |
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request. Thank you! |
Version
0.70.0.0
WSL Version
Kernel Version
5.15.68.1
Distro Version
Ubuntu20.04
Other Software
No response
Repro Steps
In the wsl version( 0.66.2.0), I can perform the following operations to achieve the purpose of accessing wsl2 through ssh
SSH to your Windows host (SSH Server must be installed in Windows Features)
ssh user@windowshost
powershell
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force
ssh user@windowshost
But now that I have upgraded to version(0.70.0.0), this operation no longer connects to wsl2
I thought I set bash as the default shell, but I found that setting bash as the default shell is no longer valid after the updated version
Expected Behavior
I was referring to this link for the purpose I wanted
VSCode Remote: Connect to WSL2 from another machine
Actual Behavior
Now that I have upgraded to version(0.70.0.0), this operation no longer connects to wsl2
Diagnostic Logs
The text was updated successfully, but these errors were encountered: