Here’s another useful post from the Howto forge guys. This will give you a quick run-through of how to configure certificate-based logins to your Linux servers. It’s not Ubuntu-specific. The same techniques will allow you to connect to a CentOS or Redhat server as well.
For the past week I have been trying to set up an RSA SSH certificate for accessing my Ubuntu servers from PuTTY and Mac’s SSH through a terminal. However I have been faced with some serious problems, thankfully the guys over at ubuntuforums.org could help me out. So here is a quick howto I wrote so that people don’t have the same kind of trouble that I did.
Combine the above with the tips from this post, which shows you how to create a custom “config” file within your local .ssh directory. This is especially useful if you have multiple servers that you access every day – especially if you access them under various accounts. Here’s an example.
Assume that your local username is hank and that you wish to connect to your server at work where your username is boomhauer. Create a file named “config” in your local .ssh directory to simplify access to the remote server:
Host strickland propane work User boomhauer Port 22 HostName s234.propane.com
This will allow you to access the remote server by typing “ssh strickland” at the command prompt. It will attempt to log you in as “boomhauer” and will use DNS to attempt to connect to the (made up) server “s234.propane.com”. It will prompt you for boomhauer’s password or, if you’ve followed the instructions at the top of the post, it will use the key that you have added to boomhauer’s authorized keys on the server and you will be logged in as boomhauer without being prompted for a password. In addition, various server aliases have been added, so you could also type “ssh work” or “ssh propane” to get to the server. Add additional host stanzas for additional servers. See the ssh_config man page or the post referenced above for more information.
Let me know if you have questions or if you found this useful (or not!).