Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rakibhasansabbir/a3efcb76fcb4850e121aab66c257c65a to your computer and use it in GitHub Desktop.
Save rakibhasansabbir/a3efcb76fcb4850e121aab66c257c65a to your computer and use it in GitHub Desktop.
How to use existing SSH key on my newly installed Ubuntu

If you have a copy of your ssh keys (e.g., on a USB stick) then simply copy the key files to the ~/.ssh/ directory.

cp /path/to/my/key/id_rsa ~/.ssh/id_rsa
cp /path/to/my/key/id_rsa.pub ~/.ssh/id_rsa.pub

change permissions on file

sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa.pub

start the ssh-agent in the background

eval $(ssh-agent -s)

make ssh agent to actually use copied key

ssh-add ~/.ssh/id_rsa

credit goes to https://askubuntu.com/a/787005/612814

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment