3

I was able to install and configure openssh on cygwin and is running just right but with one problem: I cannot use private/public key authentication, it just doesnt work.

I followed the same steps as on Linux, adding my key to ~/.ssh/authorized_Keys but it does not pick it up.

Also I checked /var/log/sshd.log but it is empty and has this rights:

-rw-r--r-- 1 cyg_server    None      0 Aug 21 12:53 sshd.log

drwx------+ 1 Administrator None    0 Aug 21 12:57 .ssh

-rw-r--r--  1 Administrator None  395 Aug 21 12:57 authorized_hosts

What am I missing?

3 Answers 3

3

If the file name is acually ~/.ssh/authorized_Keys, then you need to lowercase the K in the filename

If that's not it, try doing ssh -v to the system. That should give you some more information.

2

This could be caused by the HOME environment variable not being set. What is the result of echo $HOME? To which full path does ~/.ssh/authorized_Keys actually resolve?

Also, I believe the filename of the authorized_keys file should be all lowercase.

And last, it seems there are some weird permission issues with cygwin. Try setting permissions to 600 (not 700) for the .ssh directory and its contents. If that doesn't work, I found some old post on the cygwin mailing list where the owner of the .ssh directory and all files inside had to be SYSTEM.SYSTEM for some reason.

If this all doesn't work, check your windows Event Log. I believe that by default, cygwin's sshd logs there instead of in sshd.log (although I don't know why it would create the logfile in that case).

1

I fixed this issue on Windows 10 1909 by checking log at Event Viewer -> Windows Logs -> Application -> sshd(Source column) and setting the ownership and permissions of home, .ssh and authorized_keys files as below

chown Gowtham:none ~/
chmod g-w ~/
chmod 700 ~/.ssh/
chmod 600 ~/.ssh/authorized_keys
1
  • for me, it was chown -R Administrator ~. There was wrong owner (Administrators, with s at the end) in multiple places.
    – user7610
    Jul 18, 2022 at 11:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .