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.
1 2 3 | function authme { ssh $@ 'cat >>.ssh/authorized_keys' < ~/.ssh/id_rsa.pub } |
Just put it in your ~/.bash_profile file or one of the other bash settings files you may be using.
Usage is like so
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
{ 5 comments… read them below or add one }
Great information! I’ve been looking for something like this for a while now. Thanks!
I want to quote your post in my blog. It can?
And you et an account on Twitter?
Ya no problem, and my username on Twitter is @supairish, but FYI, I don’t post too often. Thanks for reading!
I can’t tell you how many times I’ve looked this up “authme irish” haha! Still use this to this day…probably should have my own .profile to use by now…but alas…I’m a nomad. LOL
Haha, nice Beau, glad it’s of help to someone out there!
{ 1 trackback }