Answer the question
In order to leave comments, you need to log in
How to change the default shell when connecting to Windows via SSH?
The default shell is configured with the following command:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\wsl.exe ~" -PropertyType String -Force
Permission denied (publickey,keyboard-interactive)
, although I connect without errors without a tilde. If I type in PowerShell wsl ~
, my Linux immediately opens in my home directory.
Answer the question
In order to leave comments, you need to log in
it looks like the defaultshell key just points to an executable that will run on connection. as soon as a tilde appears there (tried with vsl. exe and bash.exe) - it ceases to understand what is happening.
however, if you add cd ~ to the .bashrc of the user you're logging in with, it will simply change the directory on login.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question