How to configure OpenSSH on Windows 7
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 sourceforge.net (http://sourceforge.net/projects/sshwindows/files/OpenSSH%20for%20Windows%20-%20Release/)
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 someuser@someserver.com
Could not create directory '/home/SomeUser/.ssh'.
The authenticity of host 'someserver.com (44.135.244.22)' 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 😉
-
Categories
- Android Development
- Bash
- C programming
- dpkg/apt-get
- drupal
- Emacs
- Git
- Java
- Linux administration
- Linux device drivers
- Linux Gaming
- Linux kernel
- Linux Networking
- Linux on Windows
- Linux printing
- Linux sound and ALSA
- Package Managers
- Programming
- RPM
- Shell and environment
- Tips and tricks
- Uncategorized
- VirtualBox
- Virtualization
- web development
- wine
- WMaker
- Wordpress Tips
- X Window System
- XFCE
-
Articles
- August 2020
- August 2019
- May 2019
- July 2017
- February 2017
- January 2017
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- April 2016
- March 2016
- December 2015
- November 2015
- September 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- October 2014
- February 2014
- January 2014
- November 2013
- October 2013
- June 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- October 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- September 2011
- August 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
-
Meta
Cloud
audio bash boot compile C programming cups drupal emacs etc Fedora git grep how to httpd init kernel libc linux linux partition localtime login make mount mp3 mysql networking oracle package managers password phpMyAdmin programming rpm shell sql vbox version control system virtual box vm web server wordpress www xargs xfce xwin yum