OpenSSH on Windows 10
Well, you want to install OpenSSH server in Windows 10.
Before we start
If you found this tutorial from Microsoft, consider it is broken in multiple ways. So don’t follow it.
You can find updated steps below. I’ve tested them on Windows 10 (1903).
First delete everything:
- uninstall OpenSSH server and client from Apps & Features section in Windows 10 Settings and reboot
C:\ProgramData\sshand its contents
C:\Windows\System32\OpenSSHand its contents
- remove any OpenSSH server and client package installed through Cygwin (you should’ve done this before trying to install OpenSSH server for Windows 10
Then follow this guide (step by step). If you have Windows 10 (by this I mean the consumer version, not Windows Server 2016 or above), to open port 22 on Windows firewall, you should use:
netsh advfirewall firewall add rule name=sshd dir=in action=allow protocol=TCP localport=22
OpenSSH should be installed by now. Host keys will be generated on first run and placed
%programdata%\ssh. Important: Do not edit permissions of this folder or files inside.
Check for OpenSSH install to be on PATH:
- Go to Computer > Properties > Advanced System Settings > Environment variables > System variables > select PATH and click Edit
- Remove any OpenSSH location different than
C:\Program Files\OpenSSHand add it if it’s missing.
- Click OK and close.
You better follow also optional steps, too. For example, I’d set it to start at boot.
Just try to ssh to the freshly setup openssh server. By default port is 22 and all users are enabled to connect.
To check it:
- open the Services app (you can look for it from the search bar)
- scroll to OpenSSH SSH Server (the
sshdservice) and double click it
- in the Log On tab, Local System account should be selected.
From here you can also check if the
sshd service is set to start at boot./
One final tip
If your username has a space inside, put it between single quotes when connecting from your client machines. What’s written in Windows login screen aside, username is the one the home dir is named after (e.g. C:\Users\John Doe).
ssh 'John Doeemail@example.com
Thanks for reading.
Got some words you want to share? Tell me!