0

I'm trying to ssh from my LAN devices (phone, laptop and even the same computer) into bash.exe following Microsoft's guide on changing the default shell for OpenSSH to bash.exe. Bash in this context should start up "wsl -d YOURDEFAULTDISTRO", which it does if I run it in my local computer. However when I ssh into it, I get:

??? ????? ?????? ? ???????? ??? ?????? ??? ?? ???????
Connection to <my_ip> closed.

I can ssh into powershell normally, no problems there. My Windows are setup in the Greek language, maybe that could be why I'm getting back question marks?

2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Apr 5, 2023 at 10:24
  • Welcome to Super User! Can you add the output of wsl --version to your question (if it just outputs the help, that is useful info as well) - Thanks! Commented Apr 7, 2023 at 19:29

1 Answer 1

0

You will find a better tutorial in the blog
THE EASY WAY how to SSH into Bash and WSL2 on Windows 10 from an external machine.

This blog post uses Windows' OpenSSH and authenticates with Windows and then runs WSL2. WSL2 starts up, uses bash, and Windows handles the TCP traffic.

To summarize the article :

  • Enable the OpenSSH Server in Windows by in an Admin PowerShell :

    Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
    

    You may verify that it worked using :

    Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
    
  • To set the default shell :

    New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force
    
9
  • That's exactly what I followed actually and I get the error I mentioned in my original post.
    – AxillV
    Commented Apr 5, 2023 at 11:36
  • Your article doesn't enable OpenSSH.Server. Do the verification in the first point to see if it's enabled.
    – harrymc
    Commented Apr 5, 2023 at 11:38
  • It is enabled, at this point I've done enough setup that I'm even able to ssh from my laptop running ubuntu, into my windows machine and then ssh once again into wsl, but trying to change the default shell to bash and trying to ssh from my laptop to my windows machine produces the above error. Also trying to ssh with wsl at the end of the commands produces the same result, and it seems to be that the character match 1-1 (still unreadable question marks though)
    – AxillV
    Commented Apr 5, 2023 at 11:50
  • OK, so this is not the problem. The question marks are probably caused by your language, but we really need this error message. Try to see if you can find it in the Event Viewer. What exact value did you use for DefaultShell?
    – harrymc
    Commented Apr 5, 2023 at 11:59
  • I tried checking the auth.log file in my laptop but whenever I ssh'd there wasn't any new log so it should be somewhere else, could you help with locating it? I followed the guide listed above, "New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force", if I open bash from my computer it boots into Ubuntu as expected.
    – AxillV
    Commented Apr 5, 2023 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .