Running SSH on Windows

I needed a simple ssh client for windows. Here’s what I did when installing OpenSSH, this worked for me, so hopefully will work for your install of ssh as well 🙂

Get OpenSSH for windows from (

Run the installer, accept defaults of set the options to your liking.

Now SSH is installed but the problem is it set all options like it would on a Linux machine (the default). This won’t work on Windows. When you run ssh you will get something like this:

C:\Program Files\OpenSSH\bin>ssh
Could not create directory '/home/SomeUser/.ssh'.
The authenticity of host ' (' can't be established.
RSA key fingerprint is 56:7b:96:50:57:7c:2d:12:21:1d:3c:b2:24:08:58:16.
Are you sure you want to continue connecting (yes/no)?

And if you enter ‘yes’ to the above question you will get something like:

Failed to add the host to the list of known hosts (/home/SomeUser/.ssh/known_hosts).

So as you can see OpenSSH is trying to create a “.ssh” directory in your user directory and then access a file named “known_hosts” in there. The problem is it is using the *NIX syntax for user directories “/home/USERNAME” and this of course won’t work on Windows.

How to fix this
First add a user for yourself. Run cmd.exe, do a “cd C:\Program Files\OpenSSH\bin” and then type :

C:\Program Files\OpenSSH\bin>mkpasswd -l -u UserName >> ..\etc\passwd

Of course UserName should be your actual user name on windows.

Then open the file “C:\Program Files\OpenSSH\etc\passwd” in Notepad or any other text editor, it should have only 1 line of text in it – the config options related to your user. Scroll to the end of the line and change the Unix version of the home directory to (/home/USER) to your proper User directory i.e. change it to “\Users\UserName”, where UserName is again just placeholder for your real user name on your Windows machine.

Your ssh client should now be properly configured for Windows 😉

Tagged with:

Leave a Reply

Your email address will not be published. Required fields are marked *

Set your Twitter account name in your settings to use the TwitterBar Section.