Using setupssh-6.6.1p1-3.exe version of OpenSSH For Windows and authorized_keys requires the following.
The OpenSSH Sever service must be started by your login user, NOT 'local system'. Not sure if this will work if user A is set to start it but user B is logged in.
Edit c:\program files\openssh\etc\sshd_config file and change 'StrictModes yes' to 'StrictModes no'. Changing this setting gets automated public key access to your windows system with authorized_keys file via ssh working. Leaving this set to 'StrictModes yes' requires very explicit ownership and permissions for the following folders:
'c:\Users\UserName' AND 'c:\Users\UserName.ssh'
AND the 'c:\Users\UserName.ssh\authorized_keys' file.
I've applied recommended permissions to these folders and files on windows 7 pro with no success. I've even tried setting compatability mode to the install file BEFORE installing it, and setting combatability mode to the sshd.exe file.
Considering that under linux the solution is to ensure that only the user has permissions to access their home dir I checked my c:\Users\username folder and discovered 3 users
Steve - my user name
Administrators - the group I belong to
SYSTEM
I looked up SYSTEM and turns out its important, it lets your user account operate normally within the windows operating system. Just for the hell of it, I created a new user called john, its an Administrators user. AND then I removed SYSTEM from the c:\Users\john permissions list.
Doing this allows 'strictmodes yes' to be left on AND it gets public key access to my windows machine working as well. However instead of gaining access with a windows shell, i get access with a linux shell if I connect from a windows macine OR a linux machine, no windows commands work, only linux commands, presumably from the cygwin stuff that comes with this package. I have no idea what negative consequences if any, of doing this are.
I also located a slightly older version of openssh for windows.
OpenSSH_for_Windows_5.6p1-2.exe
Installing this version requires a little bit more work to setup.
manually create /etc/group file, with : mkgroup -l >> ..\etc\group
manually create /etc/passwd file, with : mkpasswd -l >> ..\etc\passwd
edit /etc/sshd_config file and set 'strictmodes no'
I also had to manually create my own /home/Steve/.ssh folder path from the c:\program files\openssh install folder.
My first solution involves opening sshd_config and setting strictmodes to no.
I've found a solution that allows strictmodes to be set to yes, which may be more secure, however I'm not a linux or ssh guru, so can not say for sure if this has much effect on windows.
create a new folder called home, the original home folder is a junction pointing to the c:\Users folder.
create the following folder path C:\Program Files\OpenSSH\home\YourUserName\.ssh
The following command works fine from a cmd prompt
mkdir c:\"program files"\openssh\home\%username%\.ssh
Place your authorized_keys file within c:\"program files"\openssh\home\%username%\.ssh
You must set the OpenSSH service to be started by your login user, with a password, not the "local system" user. Do this by accessing "log on" TAB of the "OpenSSH server" service property's.
This works fine for me in windows 7 pro.
Last edit: remush 2014-09-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here's another option to address the home directory issue on windows ...
cd "c:\Program Files\OpenSSH"
mklink /j home c:\users
This will create a directory junction pointing back to the c:\users directory, so all of your users/ssh files will be in a single location on the machine.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I've been trying to get public keys working on OPenSSh for windows for a few weeks now, with no success so far.
I'm using software download from : http://www.mls-software.com/opensshd.html
setupssh-6.6.1p1-3.exe
I've been following guides online to solve a permissions/ownership problem to do with authorized_keys on the windows computer, but no luck yet.
Any suggestions are welcome.
Hi all,
Using setupssh-6.6.1p1-3.exe version of OpenSSH For Windows and authorized_keys requires the following.
'c:\Users\UserName' AND 'c:\Users\UserName.ssh'
AND the 'c:\Users\UserName.ssh\authorized_keys' file.
I've applied recommended permissions to these folders and files on windows 7 pro with no success. I've even tried setting compatability mode to the install file BEFORE installing it, and setting combatability mode to the sshd.exe file.
Considering that under linux the solution is to ensure that only the user has permissions to access their home dir I checked my c:\Users\username folder and discovered 3 users
I looked up SYSTEM and turns out its important, it lets your user account operate normally within the windows operating system. Just for the hell of it, I created a new user called john, its an Administrators user. AND then I removed SYSTEM from the c:\Users\john permissions list.
Doing this allows 'strictmodes yes' to be left on AND it gets public key access to my windows machine working as well. However instead of gaining access with a windows shell, i get access with a linux shell if I connect from a windows macine OR a linux machine, no windows commands work, only linux commands, presumably from the cygwin stuff that comes with this package. I have no idea what negative consequences if any, of doing this are.
I also located a slightly older version of openssh for windows.
OpenSSH_for_Windows_5.6p1-2.exe
Installing this version requires a little bit more work to setup.
'AuthorizedKeysFile /etc/authorized_keys' AND I placed my authorized_keys file in that folder.
This works also
Guide : http://diddy.boot-land.net/ssh/files/ssh_openssh.htm
Download : http://miked.ict.rave.ac.uk/display/sshwindows/OpenSSH+for+Windows that site has a few other versions as well, i've not tested the older ones.
So in summary.
open sshd_config and set 'strictmodes no' and your ok.
I'm not a linux guru and don't know if this is very risky.
My first solution involves opening sshd_config and setting strictmodes to no.
I've found a solution that allows strictmodes to be set to yes, which may be more secure, however I'm not a linux or ssh guru, so can not say for sure if this has much effect on windows.
Install setupssh-6.6.1p1-3 from http://www.mls-software.com/opensshd.html
navigate to the "C:\Program Files\OpenSSH" folder
rename home folder to home.bak
create a new folder called home, the original home folder is a junction pointing to the c:\Users folder.
create the following folder path C:\Program Files\OpenSSH\home\YourUserName\.ssh
The following command works fine from a cmd prompt
mkdir c:\"program files"\openssh\home\%username%\.ssh
Place your authorized_keys file within c:\"program files"\openssh\home\%username%\.ssh
You must set the OpenSSH service to be started by your login user, with a password, not the "local system" user. Do this by accessing "log on" TAB of the "OpenSSH server" service property's.
This works fine for me in windows 7 pro.
Last edit: remush 2014-09-01
Here's another option to address the home directory issue on windows ...
cd "c:\Program Files\OpenSSH"
mklink /j home c:\users
This will create a directory junction pointing back to the c:\users directory, so all of your users/ssh files will be in a single location on the machine.
'AuthorizedKeysFile /etc/authorized_keys' in sshd_config worked for me.
Thanks