spm
—
simple password manager
spm
is a fully POSIX shell compliant script using
gpg2(1) for
encryption.
Entries are stored in a classical filesystem hierarchy where
passwords are encrypted as individual files and directories may be used as
groups. This way users can control access through file ownership, share
entries entries with symbolic links and more just like any other files.
Group and entry names or expressions are considered relative to
the storage root directoy. expression is interpreted
as basic regular expression according to
re_format(7).
The following commands are available:
add
- Prompt for a password if standard output is a terminal otherwise read from
standard input and store it as entry. If
group is specified, non-existing groups are created
automatically and the password is stored under
group/[../].
del
- Ask for confirmation and delete the entry matching
expression on success.
help
- Print a short usage and refer to this manual page.
list
- Print a recursive, indented tree-style list of all entries in
group. If group is omitted,
the entire storage root is listed. If the
-g
flag
is passed only subgroups are shown.
search
- Print the absoloute paths of all entries matching
expression one per line.
show
- Print the password to standard output if expression
uniquely matches an entry and prompt for the decryption passphrase if it
is not cached by
gpg-agent(1)
already.
The following environment variables will be used by spm
if they are set and not empty:
PASSWORD_STORE_DIR
- The storage root directory. This should be an absoloute path.
PASSWORD_STORE_KEY
- Key ID used for de/encryption. Refer to
gpg2(1)
for accepted formats.
- ~/.spm/
- The default storage root directory.
spm
exits 1 if an error occurs otherwise 0.
Add Alice's password to the group users:
$ spm add users/alice
Password for 'users/alice':
Make sure she is an admin as well:
$ (cd ~/.spm
> mkdir admins
> ln -s ../members/alice admins/alice)
Copy her password into the X selection ready to be pasted
somewhere:
$ spm show admins/alice | xclip -i
Find all admins starting with “a” or
“b”:
$ spm search admins/[ab]
/home/alice/.spm/admins/alice
/home/alice/.spm/admins/bob
List all users:
$ spm list users
/home/alice/.spm/users
|-- alice
|-- bob
|-- temporary/
| |-- tim
| `-- tom
Find entries interactively using
dmenu(1):
$ spm show "$(spm search . | dmenu -l 10)"
Groups have to be deleted manually using
rmdir(1).