Blog

Pass, a password manager

How I am using pass


It’s been some time since I been using Pass and I want to write some notes on useful resources and how I am using.

The Basics:

Pass its pretty simple at its core, it follows the UNIX philosophy so it focuses on only one thing: managing passwords.

Pass its a CLI tool that allows us to easily save and edit passwords in our filesystem. This means that the passwords are going to be saved in the device we are using pass on. The thing is that pass encrypts the files for us:

Each password lives inside of a gpg encrypted file whose filename is the title of the website or resource that requires the password.

Basically:

All passwords live in ~/.password-store, and pass provides some nice commands for adding, editing, generating, and retrieving passwords. … It’s capable of temporarily putting passwords on your clipboard and tracking password changes using git

Setting it up

The official website explain this perfectly well. But if you don’t know much about encryption like me there is something important to understand:

Pass uses GPG to encrypt and decrypt the files. GPG keys are typically saved in ~/.gnupg/ directory. There you will have your public and private keyring respectively (and other things too but lets keep this simple).

Public keys are used to encrypt data and can be shared. Private keys are used to decrypt data and shouldn’t be shared. (you share public keys so that anybody can encrypt and send you data, but only you can decrypt it).

This is what its called asymmetric encryption and it is what pass uses to encrypt your password files. (GPG can also handle symmetric encryption, but as far as I know, pass uses asymmetric).

Resources to understand dig deeper about encryption:
  • A quick video to understand symmetric and asymmetric encryption
  • An articles series to understand GPG and the concepts of hashes, digital signatures and symmetric, asymmetric encryption
    • Part 1 Core concepts
    • Part 2 Using GPG for asymmetric encryption
    • Part 3 Digital Signatures
    • Part 4 Using GPG for symmetric encryption

So, before you run the pass init "your GPG key ID" command, you need to create a key-pair first. You can do that easily using gpg --full-generate-key (there are plenty of guides out there, but the command its pretty straight forward). Just remember that GPG will save your keys in ~/.gnupg/. Once created you can use: gpg -k to see your public keyring (all your public keys) and select the one you want to use for pass. (The id of the key can be the email you used for it or the string of random characters and numbers. Again there are lots of guides in internet to better understand this)

Backup:

GPG keys might or might not have an expiration date, but you can use GPG CLI to export your keys and back them up. This way you can backup both your GPG key and your pass files stored in ~/.password-store. Another useful thing is to initialize pass repo as a git repo. For this you can run pass git init and there you go. You can use all the git commands prefixing pass before, so that you can keep track of all the changes of your passwords.

Sync with Android:

Pass itself its just a CLI. But the community has developed other clients and GUIs for different platforms. In my linux desktop I like to use QtPass and for Android we can use Android Password Store. But unfortunately this is not so straight forward.

Remember that pass runs on your local filesystem, so your phone has no way to automatically sync with your pc pass. You could copy both your gpg keys and your passwords manually to your phone but keeping them both in sync would be a hassle. What I recommend doing is setting your pc as a localhost git server so that your phone can pull & push changes (thankfully passwordstore helps us pretty much follow this strategy).

Localhost Git Server on your desktop:

We are going to allow ssh connections to our machine, and we are going to setup a git bare repo to allow pulling and pushing changes to it.

SSH Connections:

Git bare repo:

Now that our phone can connect via ssh to our pc, we need to create our git bare repo to allow pushing and pulling from it.

Android Setup:

Now we need to setup our android:

A Final Note

If you just want a password manager and don’t want to worry about a single thing, then this setup its not for you.

There are pretty good free options like BitWarden, Passky, KeePass/KeePassXC or ProtonPass. And other premium ones like 1Password.

For me learning how to use and configure pass was something I found interesting and rewarding. I had never configured a git server before and my ssh and GPG knowledge was the bare minimum. I know this its not a flashy project, but I had a great time setting and understanding all this up.

External resources:

Using pass its not hard once you get used to it. But these resources helped me a lot to understand it when I started to use it: