The SSH-copy-id command can install the local SSH public key file to the account corresponding to the remote host.
I have been manually using SCP and SSH commands to execute this task. I just found this convenient command!
SSH-COPY-ID (1) SSH-COPY-ID (1)
Name
Ssh-copy-ID-install your public key in a remote machine's authorized_keys
Synopsis
Ssh-copy-ID [-I [identity_file] [user @] Machine
Description
Ssh-copy-ID is a script that uses SSH to log into a remote machine (presumably using a login password, so Password Authentication shocould be enabled, unless you 've
Done some clever use of multiple identities)
It also changes the permissions of the remote user's home ,~ /. Ssh, and ~ /. Ssh/authorized_keys to remove group writability (which wowould otherwise prevent you from
Logging in, if the remote sshd has strictmodes set in its configuration ).
If the-I option is given then the identity file (defaults ~ /. Ssh/id_rsa.pub) is used, regardless of whether there are any keys in your ssh-agent. Otherwise, if
This:
Ssh-add-l
Provides any output, it uses that in preference to the identity file.
If the-I option is used, or the ssh-add produced no output, then it uses the contents of the Identity file. Once it has one or more fingerprints (by whatever
Means) It uses SSH to append them ~ /. Ssh/authorized_keys on the remote machine (creating the file, and directory, if necessary)
See also
SSH (1), ssh-agent (1), sshd (8)
OpenSSH 14 November 1999 SSH-COPY-ID (1)
Manual page ssh-copy-ID (1) line 1/34 (end)