0

I've setup an OpenSSH server on my windows machine and have been able to successfully SSH from windows box to my Linux machine (and vice-versa) successfully.

Although, I am not able to set up key authentication for the same... here are the steps that I followed

On Windows - OpenSSH

C:\OpenSSH\bin> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/Arpit/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/Arpit/.ssh/id_rsa.
Your public key has been saved in /home/Arpit/.ssh/id_rsa.pub.
The key fingerprint is:
b9:0c:33:15:9f:8a:bf:02:cf:80:43:7c:6e:42:07:52 Arpit@Windows-HOST

C:\OpenSSH\bin> scp "C:\Documents and Settings\Arpit\.ssh\id_rsa.pub" Arpit@Linux-HOST:

Tried ssh after these steps but it was asking password to connect

On Linux

[arpit@Linux-HOST ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/arpit/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/arpit/.ssh/id_rsa.
Your public key has been saved in /home/arpit/.ssh/id_rsa.pub.
The key fingerprint is:
e8:ac:43:a5:52:d5:ca:11:ea:2f:ae:b9:b0:cb:ba:8e arpit@Linux-HOST
[arpit@Linux-HOST ~]$ ssh-copy-id -i /home/arpit/.ssh/id_rsa.pub arpit@Windows-HOST
arpit@Windows-HOST's password:
Now try logging into the machine, with "ssh 'arpit@Windows-HOST'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

Still no luck. Can anybody help me with the same?

  • It might just be asking for the passphrase to decrypt the key. – Der Hochstapler Jun 17 '13 at 17:00
2

Have you copied the public key into authorized_key file in your linux machine?:

Open the "C:\Documents and Settings\Arpit.ssh\id_rsa.pub" file with notepad, copy the content and append to .ssh/authorized_key in your Linux machine. Then try again

  • Yes, did it. Still asking for password :( – Arpit Jun 17 '13 at 10:02
2

On my client (windows) i had an wrong id_rsa.pub file in my ~/.ssh/ folder.

After I deleted this file the public key authentication worked just fine.

I found this solution here: https://superuser.com/a/1067189/724897

0

Well, it looks like apart from the user directory (C:\Documents and Settings\[username]\.ssh) directory, we need to copy the authorized_keys file to the following location:

[OpenSSH Installation Directory]\etc\

Key authentication started working once I copied the remote host's public keys at the above mentioned location.

0

In case anyone hits the same error as me. If you save your id_rsa key with notepad it will be a txt file, and openssh won't find it. To remedy this open id_rsa, save as, all types, and then give it the name "id_rsa" with the quotes. This saves it without an extension an openssh likes you again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.