Home » Questions » Computers [ Ask a new question ]

Setting up a machine to use a key over SSH

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.

Asked by: Guest | Views: 232
Total answers/comments: 2
Guest [Entry]

"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."
Guest [Entry]

"I had trouble with keys on a server running Ubuntu. One way to test is to this on the server:

sudo /usr/sbin/sshd -d -p [some port]

And then connect using

ssh -v server.url -p [same port]

This should give you debug info on both sides. The sshd process will probably be more interesting because it will tell you why it's rejecting the key.

My solution was to just give up and move authorized keys to /etc/ssh/users/[user name]/authorized_keys and then changed /etc/ssh/sshd_config's AuthorizedKeysFile setting:

AuthorizedKeysFile /etc/ssh/users/%u/authorized_keys

It's sort of a brute force solution, but it might solve your problem."