Alex Claman

Pass Backups and Migration



password-store keeps your passwords (or any other sensitive information) saved in GnuPG encrypted files organized in ~/.password-store.

Mostly archiving this here for my own future reference, but also in the event that the StackOverflow suite of sites continues its AI-fuelled downward trend.

Migration

Pulled primarily from SuperUser with an added section from this gist

This requires setting up a remote git repo (which is also a good idea for redundancy/interoperability:

$ pass git init
$ pass git remote add origin <url>
$ pass git add -A
$ pass git commit -m "initial commit"
$ pass git push -u origin master

This will push all passwords to the git repo; make sure that the git repo is private.

Now back up the GPG key:

List all keys with gpg --list-keys (also gpg -k).

$ gpg --export-secret-keys $ID > my-private-key.asc

Copy the file my-private-key.asc to a USB drive or whatever storage device you have.

To restore the passwords again, copy the private key file to the new system and of course, don’t forget the passphrase of GPG key and then run these commands:

$ gpg --import my-private-key.asc
$ git clone <url> ~/.password-store/

You’ll probably have to trust with gpg --edit-key <fingerprint> – note that this will open a GPG-specific command prompt; enter the trust command and follow the instructions.

Back-up

A very simple solution found in the comments of this Reddit post:

$ tar -czf password-store-backup-<date>.tar.gz ~/.password-store/
$ gpg --cipher-algo AES256 -r <username> --sign -e password-store-backup-<date>.tar.gz
$ cp password-store-backup-<date>.tar.gz.gpg /<backup_path>

N.B.: There is also a Github repo of useful plug-ins; will go through these in the future.