A while ago I wrote a tip that showed you how to copy your public SSH key to a remote server to allow you to login without entering a password every time. I’ve since put this into a script that I use, and today I got sick enough of copying that script onto yet another machine that I packaged it up as a gem, so now we can all use it.
It works just like the plain old ‘ssh’ command, but this time you’ll never have to enter your password again:
Your key will be generated (if necessary), copied to your server, and you’ll be logged in as normal.
gem sources --add http://gemcutter.org gem install ssh-forever
[matt@bowie ssh-forever (master)]$ ssh-forever firstname.lastname@example.org You do not appear to have a public key. I expected to find one at /Users/matt/.ssh/id_rsa.pub Would you like me to generate one? [Y/n]y Copying your public key to the remote server. Prepare to enter your password for the last time. email@example.com's password: Success. From now on you can just use plain old 'ssh'. Logging you in... Linux broncos 2.6.29-xeon-aufs2.29-ipv6-qos-grsec #1 SMP Thu Jul 9 16:42:58 PDT 2009 x86_64 _ | |__ _ _ ___ _ _ __ ___ ___ | '_ \ '_/ _ \ ' \/ _/ _ (_-< |_.__/_| \___/_||_\__\___/__/ Welcome to broncos.dreamhost.com Any malicious and/or unauthorized activity is strictly forbidden. All activity may be logged by DreamHost Web Hosting. Last login: Sat Aug 15 17:24:17 2009 [broncos]$
Because I can never remember how to do it by hand. Now I don’t have to, and nor do you.