0

I have setup an OpenSSH server on a Windows 2022 machine with key based authentication. It works, I can connect from a client using: ssh myuser@server.tld

Unfortunately, OpenSSH uses cmd as the default shell, I am more used to Powershell (core) these days. I used the solution from this question and pointed the DefaultShell registry key to the Powershell executable and restarted the SSH server with Restart-Service sshd.

However, then my connection no longer works. ssh myuser@server.tld results in:

myuser@server.tld: Permission denied (publickey)

Nothing has changed in terms of public/private keys. As soon as I remove the DefaultShell key again, the connection works (and connects to the cmd shell).

How can I connect over SSH and use my existing public/private key pair?

1 Answers1

1

Unfortunate mistake: I used quotes when defining the registry key manually.

This does not work and results in the found error: DefaultShell set to pwsh.exe, but using double quotes around the path

This works without isue:
DefaultShell set to pwsh.exe, without using any quotes around the path

I found this by following the troubleshooting steps from this answer. Once sshd -d was running it showed that it could not find the path to the DefaultShell with quotes.