Skip to content

Instantly share code, notes, and snippets.

@cristiangrojas
Last active August 30, 2017 20:17
Show Gist options
  • Save cristiangrojas/dd983d833cf35199c59355c3a229a1f3 to your computer and use it in GitHub Desktop.
Save cristiangrojas/dd983d833cf35199c59355c3a229a1f3 to your computer and use it in GitHub Desktop.
Generate .pem file to authenticate to a virtual private server
# We're going to setup a new ssh-key on our server in order to login into it with a .pem file.
ssh-keygen -b 1024 -f [key-name] -t rsa
# If you don't have an .ssh folder, create it, then add your public key to the list of authorized_keys
cat totto.pub >> .ssh/authorized_keys
# Then copy the contents of the private file (not .pub) into a .pem file in your computer
# Change the .pem file permissions with:
chmod 600 [key-name].pem
# Now login with:
ssh -i ~/path/[key-name].pem [username]@[public-ip]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment