Posted on ::

I just added passgen, a password generator, to my colas-bash-lib collection. It is a tool that lives in your terminal, generates a password, copies it to your clipboard, and keeps a private log of what it generated and for what.

Why a log, you may ask. Because the biggest password problem is not generating strong ones, it is remembering which password goes where. My log solves it in the laziest possible way: I search it when I need to know which password I used for a given site.

What it does🔗

passgen generates a password of length 24 by default, made of lowercase letters, uppercase, digits, and a few special characters. It is careful about the details:

  • It starts with a lowercase letter, so the password is a valid identifier anywhere.
  • It deliberately avoids the zero character, to prevent confusion with the letter O.
  • The special characters are limited to -%=+_^/~?. — the ones that survive a double-click to select the whole password, which is the way I copy things from a terminal.

Then it copies the password to your clipboard, on Wayland or X11 alike. No need to select it yourself.

The log🔗

Every generated password is appended to ~/.local/state/passgen/log, with a date and an optional note. I use it this way:

  • passgen -l lists the last passwords generated, so I can find the one for a given site.
  • passgen 32 facebook generates a 32-character password and logs it as the "facebook" one.

The log is chmod'ed to be readable only by me, and I keep it in sync and backed up like the rest of my home directory. It replaced my password manager for everything but shared secrets.

Checking the strength🔗

passgen -s 24 prints the strength of a password of that length in number of combinations, which for 24 characters is about 10^42 — comfortably future-proof even against quantum computers. The default length of 24 is chosen for exactly that reason.

Why I like it🔗

  • One tool, one habit: no account, no sync, no database, nothing to learn. Generate, paste, done.
  • The password is in my control, stored in a plain file I can grep, rsync, and back up with the rest of my life.
  • Useful in a script: pipe it, adapt the length, add a note. It composes like any other command-line tool.

See it and the rest of my bash functions at colas-bash-lib.

Table of Contents