I am installing Ubuntu on a new machine. How can I back up all the entries in Passwords and Keys (aka Seahorse aka GNOME Keyring), so I can transfer them to the new machine?


Keyring data is stored in several places:

  • "Passwords" (GNOME Keyring data) are stored in ~/.local/share/keyrings

  • "Secure Shell" data (SSH keys) are stored in ~/.ssh

  • "PGP Keys" (including GPG keys) are stored in ~/.gnupg

You will need to backup and restore each of these folders. Preferably don't use a flash drive to do this (see note below). When restoring the folders, make sure the permissions are set correctly (see note below).

Note on flash drives

You should avoid using a flash drive to store/transfer keys, even temporarily, since deleted data is easily recoverable from a flash drive unless you take precautions, like encrypting the drive. If you have a network connection, transfer over ssh would be both convenient and secure.

Note on permissions

When you restore the folders, they need the correct ownership permissions, which you can apply as follows:

chown --recursive USERNAME:USERNAME ~/.ssh
chmod 755 ~/.ssh
chmod 644 ~/.ssh/known_hosts
chmod 644 ~/.ssh/authorized_keys
chmod 600 ~/.ssh/config
chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa.pub
# repeat the last two for other public/private pairs
# you may need to "service ssh restart" after changing these values

chown --recursive USERNAME:USERNAME ~/.gnupg
chmod 700 ~/.gnupg
chmod 600 ~/.gnupg/*
# for any subfolders, you need to apply 700 to the folder
# and 600 to the files in that subfolder:
# chmod 700 ~/.gnupg/subfolder
# chmod 600 ~/.gnupg/subfolder/*


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.