Skip to content

Instantly share code, notes, and snippets.

@dshipp
Created October 21, 2014 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dshipp/9a6373c7c0389ab2e984 to your computer and use it in GitHub Desktop.
Save dshipp/9a6373c7c0389ab2e984 to your computer and use it in GitHub Desktop.
Generates an RSA keypair and installs it in a remote machine's authorized_keys, so you can ssh to that machine without a password prompt
# Generate a new ID without passphrase if one doesn't exist
if [ ! -e ~/.ssh/id_rsa.pub ] ; then
yes | ssh-keygen -f ~/.ssh/id_rsa -N ''
ssh-add
fi
# Copy the id to the target machine (this will prompt you for a password)
ssh-copy-id username@target.host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment