Skip to content

Instantly share code, notes, and snippets.

@jcwright77
Last active August 25, 2019 11:41
Show Gist options
  • Save jcwright77/7d5a934338140af025eba6f6e0868c32 to your computer and use it in GitHub Desktop.
Save jcwright77/7d5a934338140af025eba6f6e0868c32 to your computer and use it in GitHub Desktop.
ssh_key_create
#make key
ssh-keygen -f <keyname> -C this is a test
#verify passphrase
ssh-keygen -y -f <keyname>
#install key locally
# optionally create .ssh
mkdir ~/.ssh
chmod 700 ~/.ssh
cp -p <keyname> <keyname.pub> ~/.ssh/
#install key remotely
ssh-copy-id -i <keyname> <user>@<server>
#ssh-copy-id may not be on OSX by default, it can be installed with macports or brew, it is mostly equivalent to
cat ~/.ssh/<serverkey>.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
#login with new key
ssh -i <keyname.pub> <user>@<server>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment