6. Add Your Public Key to Remote Machines the Easy Way
In
order to perform key based logins to a new machine, you need to get a copy of a
public key to the remote machine yourself. Sure, you could do this manually –
which gets a bit boring after a while (why doesn’t SSH have an authorized_keys.d
anyway?), but why waste time when SSH comes with it the tool to do it?
Just
run:
ssh-copy-id -i .ssh/id_rsa.pub hostname
After being prompted to enter your password for the last time, SSH will
say:
Now try logging into the machine, with “ssh ‘hostname’”, and check
in:
.ssh/authorized_keys
to make sure we haven’t added extra keys that you weren’t
expecting.
Try it. No more passwords!

