Skip to content

Instantly share code, notes, and snippets.

@mattantonelli
Last active May 2, 2017 17:55
Show Gist options
  • Save mattantonelli/8c2a0b84ffe51674f3eb to your computer and use it in GitHub Desktop.
Save mattantonelli/8c2a0b84ffe51674f3eb to your computer and use it in GitHub Desktop.
Generate SSH keys and copy public key to remote host with ssh-agent.
# Generate your SSH key pair with the RSA algorithm
ssh-keygen -t rsa -C user@example.com
# Add the key pair to ssh-agent, if you are using it (optional)
ssh-add
# Copy public key to SSH destination
ssh-copy-id login@destination
# Show your public key
ssh-add -L
# SSH to remote host and confirm presence of public key
ssh login@destination
cat .ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment