S
S
SurPaul2020-12-30 21:10:55
linux
SurPaul, 2020-12-30 21:10:55

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

How do I change the command to open WSL in my home directory? I have tried the following command:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\wsl.exe ~" -PropertyType String -Force

But in this case, when I try to connect, I get 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

1 answer(s)
A
azarij, 2020-12-31
@SurPaul

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 question

Ask a Question

731 491 924 answers to any question