As you may know, I'm a big fan of one-liners. Scripts, that is, not jokes. Tired of having to type your password every time you log into that rarely-used machine, but don't want to go through the hassle of editing the authorized keys on the remote host? Make a script, call it 'addpublickey' or some such:
#!/bin/sh cat ~/.ssh/id_dsa.pub | ssh $1 "cat >> .ssh/authorized_keys"
OK, so that's two lines. But if you use ash or bash, you can dispense with the shebang line. So there.
You might want to check for a valid string in "$1". And don't forget the double-quotes around the remote cat statement... or it won't be remotely what you wanted to do.
Back to blog or home page
last updated 2013-01-10 20:32:57. served from tektonic