1

I am attempting to ssh without password to Linux server from WSL in Win10. I setup private and public keys as usual, copy over public key to Linux server, and add it to authorized keys.

ssh still requires password.

What is the procedure for using keys when within WSL, if possible?

4
  • AFAIK there is no special procedure (I just tried it and it worked for me). What does "as usual" mean, exactly - and how did you copy the public key to the server (using ssh-copy-id or by some other means)? Does it jump straight to requiring a password, or does it try the key and fail? Have you done any lower level debugging such as adding -v / -vv / -vvv to your ssh invocation to see details of the authentication negotiation? Oct 22, 2020 at 15:40
  • In WSL, I used ssh-keygen to create a keypair, then ssh-copy-id user@host to install it, and then had keypair auth working with no issue. Check the permissions of your private key maybe?
    – DopeGhoti
    Oct 22, 2020 at 16:41
  • I was using dsa not rsa. Using steeldriver comment above, I found that dsa public was not being used. Not certain why rsa key worked without issue.
    – paulj
    Oct 22, 2020 at 17:45
  • 2
    @paulj iirc DSA for public key authentication has been deprecated/removed by OpenSSH - see for example Why OpenSSH deprecated DSA keys Oct 22, 2020 at 19:43

1 Answer 1

1

The easiest way: Generate the keypair from WSL terminal as per normal

$ ssh-keygen -t rsa -b 2048 

Then use ssh-copy-id command from WSL to remote Linux server

$ ssh-copy-id user@remote-server

You will be asked for a password. Once the password is accepted, key exchange will happen in the background. Then logout from remote Linux server and try to log back in. No password will be required this time. That's all you need

You must log in to answer this question.

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