Change OpenSSH Server default shell on Windows Server 2019

If you are using OpenSSH Server on Windows Server 2019, the default shell is cmd.exe.

If you want to set the default shell to PowerShell or even PowerShell Core, you can run the following PowerShell command (it will create a registry key) then restart the OpenSSH server service :

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

If you want to use PowerShell Core, change the path of the value variable but note that currently a path with space in directory name seems to be unsupported.

SSH avoid “Connection reset by peer”

If you are a regular SSH user, there are chances that you sometimes faced the error message “Connection reset by peer”. To avoid this message, you can edit some settings on server side or on client side. In this post I will show you both case.

Client side


If you are using Putty, there is a setting under the “Connection” tab that allow you to set the keepalive value. By default it’s disabled (value is 0).

You can set the value at 240 and each 240 seconds, Putty will send a null packets to keep the connection open.

Be sure to set this value by default each time you launch Putty by following this post : Change Putty default settings


If you are using OpenSSH (from a Linux machine or using WSL under Windows 10), you can change a settings for your user by editing the config file under the SSH directory in your home directory.

You can follow those steps :

  • Edit the config file
vi ~/.ssh/config
  • Add the settings to enable the keepalive
Host *
ServerAliveInterval 240
  • Set the following rights to the file
chmod 600 ~/.ssh/config

With this setting, your client will send a keepalive packet each 240 seconds to the remote host.

Server side

On the server side, you can edit the SSH server configuration file. If you are using Debian it will be “/etc/ssh/sshd_config”.

First, uncomment the following line :

#ClientAliveInterval 0

Then replace the value 0 by 240, save the file and restart the service.

Change Putty default settings

If you are using Putty on a regular basis there could be some settings that you would like to set by default at each launch.

To set default settings, there is only a few steps to follow.

  • Launch Putty. You will see that there is default profile called “Default Settings”.
  • Set the settings that you want to change. By example logging settings.
  • Once you have set all the settings, go back to the Session tab and select the “Default Settings” profile. Then click “Save”.

From now on, once you will launch Putty all the values will be set with the values that you have save on the “Default settings” profile.