How to change the OpenSSH server port in Windows

The installation for OpenSSH server in Windows is quite straightforward, as all we need to do is to follow the instructions here.

However, it took a while for me to figure out how to change the listening port. Especially, in the installation folder, there is a sshd_config_default file. Changing this does not make any difference. OpenSSH-InstallFolder

After digging through the documentation, I finally found that in Windows, sshd reads configuration data from %programdata%\ssh\sshd_config .

So that is where the config file is located.

OpenSSH-SSHD-Config

Changing the port is easy, all we need to do is to edit the line that specifies the port, and restart the sshd service.

OpenSSH-SSHD-Config-Port.JPG