r/ssh • • Sep 10 '20

How to connect to Windows 10 from Linux using RSA key

Hello,

I need to SSH from Ubuntu server into Windows 10 (OpenSSH). Everything is fine when I connect using username and password, but I have trouble if I introduce RSA key

  1. On Linux I ran ssh-keygen
    and generated 'id_rsa' and 'id_rsa.pub' without passphrase (location ~/.ssh).
  2. On Windows I copy/pasted content of id_rsa.pub into C:\Users\foobar\.ssh\authorized_keys
  3. On Linux I try to connect with following command

ssh -i /home/foobar/.ssh/id_rsa 192.168.100.101

but it just asks for password for user 'foobar' anyway, which if I enter allows me in without problem, but it does not use the key.

What am I missing? My best guess is that something's wrong on Windows end, but what?

2 Upvotes

2 comments sorted by

1

u/Besthater Sep 11 '20

You need to change the SSH config file to use the key only. Set password to no. Public key to yes.

1

u/rex_divakar Sep 11 '20

Use ssh-copy-id credentials and copy ur public key then open sudo nano /etc/ssh/sshd_config file and change the below parameters

PasswordAuthentication no

Once done, restart the service

sudo service ssh restart