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
rsync
scripts to point to the new hosts. ↩