Last active
August 13, 2017 06:45
-
-
Save hannic/10569fd6e9100209f3a01ea653ec1d67 to your computer and use it in GitHub Desktop.
Setup private and public keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Forgotten passphrase for private ssh key | |
# you need to remove your SSH public/private keys, recreate them, | |
# and then add your newly created public key to the servers | |
# and online services you use. | |
# Remove your SSH public/private keys: | |
rm ~/.ssh/id_rsa* | |
# Recreate the keypair, choosing a new passphrase: | |
ssh-keygen -t rsa -f ~/.ssh/id_rsa | |
# Add the newly created private key to your OS X Keychain to store the passphrase and manage unlocking it automatically: | |
ssh-add -K ~/.ssh/id_rsa | |
# Copy the public key to the OS X clipboard for adding to web services like GitHub, etc. | |
cat ~/.ssh/id_rsa.pub | pbcopy | |
# Add your newly created public key to the ~/.ssh/authorized_keys file of the remote server. | |
# Be sure to ensure the correct permissions of both the remote ~/.ssh folder (700) and ~/.ssh/authorized_keys (600). | |
# You may want to investigate using ssh-copy-id to ease this process. | |
# Source: https://superuser.com/questions/760907/forgot-password-to-id-rsa | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment