Backup e restore de chaves SSH

Tags: linux Category: DevOps

Backup

  • Copy both id_rsa and id_rsa.pub from ~/.ssh/ to a USB drive.

Restore

  • Copy both id_rsa and id_rsa.pub to ~/.ssh/
  • Change file permissions and ownership of both files.
$ chown user:user ~/.ssh/id_rsa*
$ chmod 600 ~/.ssh/id_rsa
$ chmod 644 ~/.ssh/id_rsa.pub
  • Start the ssh-agent.
$ exec ssh-agent bash
  • Add your SSH private key to the ssh-agent.
$ ssh-add ~/.ssh/id_rsa

Now you’re ready to use Git and update your repositories.