DEV Community

Discussion on: How to use SSH properly and what is SSH Agent Forwarding

Collapse
 
mhogerheijde profile image
Matthias Hogerheijde

I would propose mentioning ssh-copy-id over manually editing ~/.ssh/authorized_keys.

ssh-copy-id takes the same -i argument, so if you use a non-standard location for your key, lets say ~/foo/bar/id_rsa and ~/foo/bar/id_rsa.pub, then

$ ssh-copy-id -i ~/foo/bar/id_rsa user@remote-machine

will open ssh, ask for password, copy the ~/foo/bar/id_rsa.pub file into ~/.ssh/authorized_keys on the remote.

Otherwise

$ ssh-copy-id user@remote-machine

will copy whatever keys it finds to the remote (might be multiple!)