Use pass to manage passwords

Tags:  Linux Terminal Cheat Sheets

Stop using the same password across different services, use a password manager instead. Here is one of the most suckless password manager, pass (This exist on most distro’s software repo!).

Initial setup

Create a gpg key and setup a passphrase, which serve as the master password.

gpg --full-generate-key

Then initialise the pass directory.

pass init "key"

Add passwords

Use the following command to add passwords, it can be in a subdirectory,

pass insert email/example@gmail.com

then type in the password twice. Or use pass to generate password of 20 characters using the following command.

pass insert email/example@proton.me 20

To create multi-line passwords.

pass insert -m account/vpn

Then insert multi-line password, and hit ctrl+d to exit.

List passwords

To view a list of created passwords, just use the command pass, it will give the following output.

Password Store
├── account
│   └── vpn
└── email
    ├── example@gmail.com
    └── example@proton.me

View passwords

To show the password in the terminal, use the following command and type in the master password.

pass show email/example@gmail.com

Or directly copy to clipboard without displaying in terminal.

pass show -c email/example@gmail.com

Change master password

gpg --edit-key $(cat .password-store/.gpg-id)

Enter the command passwd, enter current password in the prompt, then enter new password. Lastly, save it using the save command.