The authme, ssh key, bash function

by Irish on April 19, 2010

Often it can be a pain to remember all the username/password combinations for all the different servers we touch in our day to day development.  I’ve come to really like this lil’ bash function given to me by my co-worker Anthony DiGirolamo.

function authme {
  ssh $@ 'cat >>.ssh/authorized_keys' < ~/.ssh/

Just put it in your ~/.bash_profile file or one of the other bash settings files you may be using.

Usage is like so

$ authme

You’ll be prompted for your password then returned to the local terminal prompt. This will ssh onto the given server and concatenate your ssh public key to the authorized_keys file. Allowing you from there on out, not having to supply a password to get on the server through ssh. Good stuff