Skip to content

Instantly share code, notes, and snippets.

@ChristopherA
Created January 27, 2017 07:50
Show Gist options
  • Save ChristopherA/29b955d78a294151d959d3adea9351f0 to your computer and use it in GitHub Desktop.
Save ChristopherA/29b955d78a294151d959d3adea9351f0 to your computer and use it in GitHub Desktop.
#generate key on client
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
#set permissions on client
chmod 700 .ssh; chmod 640 .ssh/authorized_keys
# start ssh-agent on client and give it new key
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
# On mac, copies the ssh key to clipbaord
more ~/.ssh/id_rsa.pub | pbcopy | printf '\''=> Public key copied to pasteboard.\n'\'
# Or copy usin ssh
cat ~/.ssh/id_rsa.pub | ssh user@10.0.1.7 'cat >> .ssh/authorized_keys'
ssh user@10.0.1.7 mkdir -p .ssh
ssh user@10.0.1.7 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment