I usually get at least one step wrong when doing ssh-keygen and transferring they public key by hand, so here [WayBack] is a nice script called trusted-key-exchange.sh
that helps you install a private/public keypair for remote SSH login without having to type a remote password.
Edit:
The script uses
ssh-copy-id
to actually perform the copying of the public key portion to the destination server. So you can also use this command to do that yourself:ssh-copy-id -i ~/.ssh/id_ed25519.pub user@target-host
ssh-copy-id -i ~/.ssh/id_rsa.pub user@target-host
Note that at the time of editing (early 2018), you should not use DSA based keys any more; see [WayBack] Secure Secure Shell.
Note:
- unlike the script does (using empty passphrases for a
root
account), it is always a good idea to have a local passphrase for protecting any private key. - more examples at [WayBack] Ssh-copy-id for copying SSH keys to servers | SSH.COM
–jeroen
via: [WayBack] ssh-keygen: password-less SSH login script | Novell User Communities.