Add an ssh key to another user on a different system without logging in
Scott liked my terminal style from yesterday, so I’ll reprise it.
heian:<<<umi-misc/pubkeys$ ssh cse125@neathat.com -p 14522 sudo ls \>/dev/null
[sudo] password for cse125: (echoed, which is unfortunate)
heian:<<<umi-misc/pubkeys$ cat djc_hmac_rsa.pub | ssh cse125@neathat.com -p 14522 sudo su -c \'cat \>\> ~djc/.ssh/authorized_keys\'
heian:<<<umi-misc/pubkeys$
Now DJ can use his key on that server.
The sudo ls is to enter the password and get the sudo authorization ticket. We can’t enter the password with the cat, because ssh sees its stdin isn’t a terminal and refuses to allocate a tty. A stupid workaround would be (echo "mypassword"; cat ... ); | ssh ..., but I like the two-phase solution more, for some reason.
April 15th, 2008 at 6:33 pm
Wow, Neat Hat looks like lots of fun. You guys have an unstoppable team.
April 28th, 2008 at 12:47 pm
Just commenting on the new design; looking real good man.