You want to set up key-based authentication so you can
ssh into a server without entering that pesky password over and over again?
If you have to do this often, then use this wonderful one-liner to install the public key of your system on a remote server1:
cat ~/.ssh/id_?sa.pub | ssh <host> 'mkdir -p .ssh; cat >> ~/.ssh/authorized_keys'
Easy, right2? Replace
<host> with your host, or possibly even
user@host. To be able to use just
<host>, you’ll want to configure SSH host aliases, e.g.:
Host seedbox2 HostName norris.com User chuck Port 55555
I use this to add seedboxes to driverpacks.net’s hosting infrastructure — the Seedbox hosting companies switch machines quite frequently, which means I have to change the
rsyncscripts to point to the new hosts. ↩︎
Notice the question mark in
id_?sa.pub? That way, it’ll pick up your public key for sure, no matter if it’s