Secret Pass
Secret Pass
Pass is a simple shell script that helps you manage and synchronize passwords using Git.
If you are like many Linux users today, you have dozens of online accounts for different services and websites. If you care about security, you are really not supposed to give those accounts the same password; nor is it considered safe to write all your passwords down on paper and store it in your desk drawer. Password managers evolved as a means for letting users store their passwords safely. Password managers differ in form and functionality, but the basic idea is that the password manager stores your passwords in a safe, encrypted format, and you provide one password to gain access to the password store. Instead of having to memorize all your passwords, you just have to memorize one.
Pass [1] is a lean password manager that relies on some classic Linux tools to help you generate and manage your passwords.
What Is Pass?
Pass is basically just a shell script that bundles various tasks involved in managing passwords into functions that are easy to use. The Pass script integrates a number of other tools that make it possible to back up data using strong cryptography, to copy passwords directly to the clipboard, or to manage the entire database using a version control system.
Pass uses GnuPG to encrypt files, Git to manage the files, and xclip
to copy them to the clipboard. When installing Pass, most package managers automatically update the existing GnuPG files. In addition to xclip
, the program usually requires a tool for displaying directory hierarchies (tree
) (Listing 1).
Listing 1
The tree Tool
$ pacman -Si pass Repositorium : community Name : pass Version : 1.7.1-1 Description : Stores, retrieves, generates, and synchronizes passwords securely Architecture : any URL : https://www.passwordstore.org/ Licences : GPL2 Groups : None Provides : passmenu Depends on : xclip bash gnupg tree Optional dependencies : git: for Git support dmenu: for passmenu qrencode: for QR code support Conflicts with : passmenu Replaces : passmenu Download size : 18.33 KB Installation size : 45.00 KB Packer : Lukas Fleischer <lfleischer@archlinux.org> Created on : Fr 14 Apr 2017 10:31:38 CEST Verified by : MD5 sum SHA-256 sum Signature
GnuPG lets you create a key suitable for signing or encrypting data, and Pass takes advantage of this function. It is still a somewhat complicated matter to create a key correctly and then keep it safe. However, various pages on the web can help you get started with the subject [2].
Initializing
If you call the tool with the init
parameter, it also requires the ID of the GnuPG key that you will be using to encrypt the files. Use the -p <directory>
option to specify that the key only applies to a subtree of the password collection. You can separate business passwords from private passwords in this way.
All the files you manage with Pass are located below .password-store/
in your home directory. If you want to use a different directory, set the environment variable PASSWORD_STORE_DIR
accordingly (see Table 1).
Table 1
Key Variables
|
Folder for password files |
|
Standard length of passwords generated |
|
Enables extensions |
|
Folder for extensions |
If you already use a password management program, the Pass website is well worth a visit: You will find a whole range of tools and scripts that help you export data from other programs, such as Revelation or KeePass. In our lab, exporting from Revelation worked without any problems. In each of the files, the additional entries were located in one line.
Pass only evaluates the first line of the file in which it writes the password for the respective access case. Further information is only used to note down usernames or URLs and other data.
If you are starting from scratch, call Pass with the generate
parameter, a name for the access case, and a number for the desired password length:
$ pass generate test/access 23
In the example, the password would be 23 characters long, and the corresponding file would end up in the access
file below the test/
password directory subfolder. If you call Pass for this access case, the software prompts you for the password to access the GnuPG key. If you enter this correctly, Pass opens the file and outputs the content to your standard output.
The -c
option copies the content directly to the clipboard, from where you can paste it again with Ctrl+V. The XSel program is used for this step. If you enter a number as the option parameter, the program tries to read the corresponding line and copy it to the clipboard. In this way, a username could also be read from the corresponding file.
Over time, a volume of access data will tend to accumulate in this way. To organize the data, simply create subfolders in the root folder (.password-store
) and move the files with the data accordingly. If you call Pass without parameters in the terminal, it shows exactly this tree structure (Figure 1). The names of the files and directories correspond to the entries for the nodes. However, the tool does not include the .gpg
extension, thus making it easier to read.

Properly Managed
If you use more than one computer, you might not always store the access data on the same computer. It is also easy to imagine circumstances in which a new account becomes necessary while you are traveling. The data you need is then on your laptop's hard disk, but you might want to continue working on your home PC later on.
A whole series of approaches are now available to help you keep a synchronous set of data across all systems; after all, Pass works with simple files. Tools like rsync
work this way: In a single step, you copy either from the mobile computer to the stationary PC or vice versa. Synchronizing in the opposite direction always requires a second step, which could be done in one go with Unison [3], but it can be done even more elegantly.
At this point, the Git [4] version control system (VCS) enters the game. Git's real purpose is to manage source code and, often additionally, the documentation and other files that come with programs. However, the software is designed in such a way that it does not really matter what kind of data you manage with it.
Pass allows you to use Git to set up your own commands. You can synchronize files and, if desired, even store the files on a central host.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Direct Download
Read full article as PDF:
Price $2.95
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs
News
-
OpenMandriva Lx 23.03 Rolling Release is Now Available
OpenMandriva "ROME" is the latest point update for the rolling release Linux distribution and offers the latest updates for a number of important applications and tools.
-
CarbonOS: A New Linux Distro with a Focus on User Experience
CarbonOS is a brand new, built-from-scratch Linux distribution that uses the Gnome desktop and has a special feature that makes it appealing to all types of users.
-
Kubuntu Focus Announces XE Gen 2 Linux Laptop
Another Kubuntu-based laptop has arrived to be your next ultra-portable powerhouse with a Linux heart.
-
MNT Seeks Financial Backing for New Seven-Inch Linux Laptop
MNT Pocket Reform is a tiny laptop that is modular, upgradable, recyclable, reusable, and ships with Debian Linux.
-
Ubuntu Flatpak Remix Adds Flatpak Support Preinstalled
If you're looking for a version of Ubuntu that includes Flatpak support out of the box, there's one clear option.
-
Gnome 44 Release Candidate Now Available
The Gnome 44 release candidate has officially arrived and adds a few changes into the mix.
-
Flathub Vying to Become the Standard Linux App Store
If the Flathub team has any say in the matter, their product will become the default tool for installing Linux apps in 2023.
-
Debian 12 to Ship with KDE Plasma 5.27
The Debian development team has shifted to the latest version of KDE for their testing branch.
-
Planet Computers Launches ARM-based Linux Desktop PCs
The firm that originally released a line of mobile keyboards has taken a different direction and has developed a new line of out-of-the-box mini Linux desktop computers.
-
Ubuntu No Longer Shipping with Flatpak
In a move that probably won’t come as a shock to many, Ubuntu and all of its official spins will no longer ship with Flatpak installed.