Linux tip: remotely add an SSH key
One great feature of OpenSSH compared to telnet, aside from security, is that you can securely keep an authentication key around while logged in, and so remotely connect to one or many remote machines without repeatedly typing your password.
Sometimes when you first get an account on a remote machine, you will only have a password, and no SSH keys will be authorized to let you log in.
I previously had a script here, but then Ben pointed out that there is now a standard mechanism to do this: ssh-copy-id. I suppose that script evolved from something similar, but it's now in the standard distribution, at least on Ubuntu.
$ ssh remotehost 'mkdir -p .ssh && cat >>.ssh/authorized_keys' < ~/.ssh/id_dsa.pub
The single-quotes are critical, and that should all be one line. You
may need to adjust the final filename depending on whether you have a
DSA, RSA, or whatever key; make sure you send the .pub file
not the key itself.
posted Tue 1 Feb 2005 in /software | link
Archives 2008: Apr Feb 2007: Jul May Feb Jan 2006: Dec Nov Oct Sep Aug Jul Jun Jan 2005: Sep Aug Jul Jun May Apr Mar Feb Jan 2004: Dec Nov Oct Sep Aug Jul Jun May Apr Mar Feb Jan 2003: Dec Nov Oct Sep Aug Jul Jun May
Copyright (C) 1999-2007 Martin Pool.