Skip to content

Instantly share code, notes, and snippets.

@jamesrr39
Created March 5, 2016 18:03
Show Gist options
  • Save jamesrr39/c39ac8a9b5d4e7b05bec to your computer and use it in GitHub Desktop.
Save jamesrr39/c39ac8a9b5d4e7b05bec to your computer and use it in GitHub Desktop.
Transferring an SSH public key
# transfer your public key to another computer
# variables that need changing marked with <>
public_key_path="<./ssh/machine-2/id_rsa.pub>"
remote_username="<james>"
remote_hostname="<192.168.x.x>"
key=$(cat $public_key_path) && \
ssh $remote_username@$remote_hostname "echo $key >> ~/.ssh/authorized_keys"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment