Thursday 19 October 2017

linux - Setting up a machine to use a key over SSH


I am trying to set up a key between my Ubuntu machine and my web server so that I can SSH into it without needing to type a password each time.


I have followed the tutorial found here - http://www.csua.berkeley.edu/~ranga/notes/ssh_nopass.html - to the letter.


Whilst everything seemed to work, when I try to SSH into the server the next time it still prompts me for a password.


My first question is that the reason I am doing this is so I can SSH onto a specific site on my server, so I set this all up on the server using the username associated with the site (in this case tosbourn) is this right or should I have used root on the server?


The second question is that because on my machine my username is different (it is toby) I think this could stop it from working? Am I correct in this assumption or should this not matter?


As it stands the home directories on both my local machine and server have .ssh in them and I have copied accross the required file and renamed it to authorized_keys (and keys2)


Any help would be greatly appreciated.



Answer



One thing to check is permissions on the key file on the server. I have found in the past that sshd will not use the authorised_keys file unless the permissions are greatly restricted.


chmod 600 ~/.ssh/authorized_keys

ought to do it.


BTW, I'm using keys generated by PuTTY to access a Linux (Slackware) server and all is well.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...