0

I am trying to use Wing Pro to debug a Python script on the RPi 3Bv1.2 (with Raspbian Jessie) and I have followed these instructions in order to create a passwordless SSH connection with my Windows PC (using plink/Putty):

http://wingware.com/doc/proj/ssh-setup-details

I have tried several times, copying both the id_rsa.pub and the copy-pasted text (in a file called key.txt) to ~/.ssh/authorized_keys but whatever I do I still get prompted for a password when I try to acces the RPi.

I have also followed another guide and added the following lines to the /etc/ssh/sshd_config file:

UsePAM no
PermitRootLogin no
AllowUsers pi
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes

And I even disabled PasswordAuthentication but then I just get this message from plink:

FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey)

Do you have any idea about what I am doing wrong?

Edit: I'n not sure which version of the public key I should copy to authorized_keys (I tried both), as there are guides indication both options: a) the id_rsa.pub with format: ---- BEGIN SSH2 PUBLIC KEY ---- Comment: "rsa-key-20170428" (key) ---- END SSH2 PUBLIC KEY b) the copy-pasted text generated by puttygen with format: ssh-rsa (key) rsa-key-20170428

Edit 2: I logged the output of plink when trying to connect with PasswordAuthentication no. I hope this helps:

https://pastebin.com/hHbufjTU

  • All you should have to do is copy the public key to authorized_keys. No one can tell you any more, because you haven't told us what you did (don't paste links to tutorials and expect people to guess what you did). The least you could do is list the exact commands you tried and the exact error message. – Milliways Apr 28 '17 at 12:28
  • Try using ssh -vv when you connect (if that's the client you are using). – goldilocks Apr 28 '17 at 12:33
  • What I did is basically create the /home/pi/.ssh folder and inside a file called authorized_keys containing the public keys. pscp openssh.pub username@remotehost:.ssh/pub.tmp plink username@remotehost "cat .ssh/pub.tmp >> .ssh/authorized_keys; rm .ssh/pub.tmp" There is no error message to share as all that happens is that I keep getting asked for a password. goldilocks: I am using plink (Putty), it doesn't have that option, nor can I give that parameter to Wing Pro – The Hun Apr 28 '17 at 12:35
  • Commands: plink username@remotehost "mkdir .ssh; chmod 700 .ssh" plink username@remotehost "sed -i -e '$a\' .ssh/authorized_keys" pscp openssh.pub username@remotehost:.ssh/pub.tmp plink username@remotehost "cat .ssh/pub.tmp >> .ssh/authorized_keys; rm .ssh/pub.tmp" – The Hun Apr 28 '17 at 12:52
1

I managed to solve this thanks to the wonderful guide by Walkernews:

http://www.walkernews.net/2009/03/22/how-to-fix-server-refused-our-key-error-that-caused-by-putty-generated-rsa-public-key/

Finally what did the trick after hours of experimenting was to change the permissions of my home folder to 755 (was 775)

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.