Question

Installing public SSH key

Posted May 8, 2014 5.5k views
Hello there. I need to add a public ssh key (from codeship.io) to my Ubuntu 12.04 machine. I have added the key to ~/.ssh/authorized_keys/id_rsa.pub and after that restarted ssh (sudo service ssh restart). However. I'm still not able to log into the server from codeship, so I'd like to know if the public key has been installed correctly. Is there a way to verify it? Thanks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer
You don't need to copy
~/.ssh/authorized_keys/id_rsa.pub
itself to the server. You need to copy its contents into the file
~/.ssh/authorized_keys 
on the server. That file can contain multiple public keys that you have authorized to access your server.

Check out this article for all the info:

https://digitalocean.com/community/articles/how-to-set-up-ssh-keys--2

To make a long story short, you could do it like so:


cat ~/.ssh/id_rsa.pub | ssh user@123.45.56.78 "cat >> ~/.ssh/authorized_keys"
Submit an Answer