2019-02-24 14:48:54 -06:00
# pash
2019-11-26 06:21:45 -06:00
A simple password manager using GPG written in POSIX `sh` .
2019-02-24 14:48:54 -06:00
2019-02-25 14:31:28 -06:00
```
pash
├─ dev/
│ ├─ github
├─ internet/
│ ├─ graalians
│ ├─ pixeljoint
│ ├─ nixers
└──┘
```
2019-02-25 00:55:10 -06:00
## Table of Contents
2019-02-25 00:54:14 -06:00
<!-- vim - markdown - toc GFM -->
* [Dependencies ](#dependencies )
* [Usage ](#usage )
* [FAQ ](#faq )
2019-02-26 12:22:55 -06:00
* [How does this differ from `pass` or etc? ](#how-does-this-differ-from-pass-or-etc )
2019-02-25 00:54:32 -06:00
* [Where are passwords stored? ](#where-are-passwords-stored )
2019-11-08 06:48:13 -06:00
* [How can I use a public key? ](#how-can-i-use-a-public-key )
2019-11-08 07:05:49 -06:00
* [How do I set the password length? ](#how-do-i-set-the-password-length )
* [How do I change the password store location? ](#how-do-i-change-the-password-store-location )
2019-11-10 16:49:31 -06:00
* [How do I rename an entry? ](#how-do-i-rename-an-entry )
2019-11-24 12:59:49 -06:00
* [How can I extend `pash`? ](#how-can-i-extend-pash )
2019-11-28 12:38:37 -06:00
* [How do I change the clipboard tool? ](#how-do-i-change-the-clipboard-tool )
2019-02-25 00:54:14 -06:00
<!-- vim - markdown - toc -->
2019-02-24 16:04:26 -06:00
## Dependencies
2019-02-25 01:04:16 -06:00
- `gpg` or `gpg2`
2019-02-24 16:04:26 -06:00
2019-02-25 00:48:54 -06:00
**Clipboard Support**:
2019-11-28 12:33:09 -06:00
- `xclip` (*can be customized through `PASH_CLIP` *).
2019-11-26 06:21:45 -06:00
2019-02-24 16:04:26 -06:00
## Usage
2019-05-22 13:58:56 -05:00
Examples: `pash add web/gmail` , `pash list` , `pash del google` , `pash show github` , `pash copy github` .
2019-02-24 16:04:26 -06:00
```
2019-02-25 00:48:54 -06:00
SYNOPSIS
2019-05-22 13:58:56 -05:00
pash [ add|del|show|list|copy ] [name]
2019-02-25 00:48:54 -06:00
COMMANDS
2019-05-22 13:58:56 -05:00
[a]dd [name] - Create a new password entry.
[c]opy [name] - Copy entry to the clipboard.
[d]el [name] - Delete a password entry.
[l]ist - List all entries.
[s]how [name] - Show password for an entry.
2019-02-24 16:04:26 -06:00
```
2019-02-25 00:53:48 -06:00
## FAQ
2019-02-26 12:22:55 -06:00
### How does this differ from `pass` or etc?
2019-11-29 09:32:28 -06:00
I was looking for a CLI password manager (*written in shell*) and wasn't happy with the options I had found. They either had multiple instances of `eval` (*on user inputted data*), lots of unsafe shell (*nowhere near being `shellcheck` compliant.*) or they were overly complex. The opposites for what I'd want in a password manager.
2019-02-26 12:22:55 -06:00
2019-11-26 06:21:45 -06:00
I decided to write my own. `pash` is written in POSIX `sh` and the codebase is minimal (*100~ lines*). `gpg` is used to generate passwords and store them in encrypted files.
2019-02-26 12:22:55 -06:00
2019-02-25 00:54:32 -06:00
### Where are passwords stored?
2019-02-25 00:53:48 -06:00
2019-11-10 16:50:16 -06:00
The passwords are stored in GPG encrypted files located at `${XDG_DATA_HOME:=$HOME/.local/share}/pash}` .
2019-02-25 00:53:48 -06:00
2019-11-08 06:48:13 -06:00
### How can I use a public key?
2019-02-24 14:48:54 -06:00
2019-11-08 06:48:13 -06:00
Set the environment variable `PASH_KEYID` to the ID of the key you'd like to encrypt and decrypt passwords with.
Example:
```sh
2019-11-08 07:05:49 -06:00
# Default: 'unset'.
2019-11-08 06:51:07 -06:00
export PASH_KEYID=XXXXXXXX
2019-11-08 06:48:13 -06:00
# This can also be an email.
export PASH_KEYID=dylan.araps@gmail.com
2019-11-08 07:05:49 -06:00
# This can also be used as a one-off.
PASH_KEYID=XXXXXXXX pash add github
```
### How do I set the password length?
Set the environment variable `PASH_LENGTH` to a valid integer.
Example:
```sh
# Default: '50'.
export PASH_LENGTH=50
# This can also be used as a one-off.
PASH_LENGTH=10 pash add github
```
### How do I change the password store location?
Set the environment variable `PASH_DIR` to a directory.
```sh
# Default: '~/.local/share/pash'.
export PASH_DIR=~/.local/share/pash
# This can also be used as a one-off.
PASH_DIR=/mnt/drive/pash pash list
2019-11-08 06:48:13 -06:00
```
2019-11-10 16:49:31 -06:00
### How do I rename an entry?
It's a file! Standard UNIX utilities can be used here.
2019-11-24 12:59:49 -06:00
### How can I extend `pash`?
A shell function can be used to add new commands and functionality to `pash` . The following example adds `pash git` to execute `git` commands on the password store.
```sh
pash() {
case $1 in
g*)
cd "${PASH_DIR:=${XDG_DATA_HOME:=$HOME/.local/share}/pash}"
shift
git "$@"
;;
*)
command pash "$@"
;;
esac
}
```
2019-11-28 12:31:30 -06:00
2019-11-28 12:38:37 -06:00
### How do I change the clipboard tool?
2019-11-28 12:31:30 -06:00
Set the environment variable `PASH_CLIP` to a command.
```sh
# Default: 'xclip -selection clipboard'.
2019-11-29 07:18:09 -06:00
export PASH_CLIP='xclip -selection clipboard'
2019-11-28 12:31:30 -06:00
```