Coder Social home page Coder Social logo

pwd.sh's Introduction

pwd.sh is a Bash shell script to manage passwords and other text-based secrets.

It uses GnuPG to symmetrically (i.e., using a passphrase) encrypt and decrypt plaintext files.

Each password is encrypted individually as a randomly-named file in the "safe" directory. An encrypted index is used to map usernames to the respective password file. Both the index and password files can also be decrypted directly with GnuPG without this script.

Install

For the latest version, clone the repository or download the script directly:

git clone https://github.com/drduh/pwd.sh

wget https://raw.githubusercontent.com/drduh/pwd.sh/master/pwd.sh

Versioned Releases are also available.

Use

Run the script interactively using ./pwd.sh or symlink to a directory in PATH:

  • w to write a password
  • r to read a password
  • l to list passwords
  • b to create an archive for backup
  • h to print the help text

Options can also be passed on the command line.

Create a 20-character password for userName:

./pwd.sh w userName 20

Read password for userName:

./pwd.sh r userName

Passwords are stored with an epoch timestamp for revision control. The most recent version is copied to clipboard on read. To list all passwords or read a specific version of a password:

./pwd.sh l

./pwd.sh r userName@1574723600

Create an archive for backup:

./pwd.sh b

Restore an archive from backup:

tar xvf pwd*tar

Configure

Several customizable options and features are also available, and can be configured with environment variables, for example in the shell rc file:

Variable Description Default Available options
PWDSH_COPY clipboard to use xclip pbcopy on macOS
PWDSH_COPY_ARGS arguments to pass to clipboard command unset (disabled) -i -selection clipboard to use primary (control-v) clipboard with xclip
PWDSH_TIME seconds to clear password from clipboard/screen 10 any valid integer
PWDSH_LEN default password length 14 any valid integer
PWDSH_COPY copy password to clipboard before write unset (disabled) 1 or true to enable
PWDSH_DAILY create daily backup archive on write unset (disabled) 1 or true to enable
PWDSH_CHARS character set for passwords [:alnum:]!?@#$%^&*();:+= any valid characters
PWDSH_COMMENT unencrypted comment to include in index and safe files unset any valid string
PWDSH_DEST password output destination, will set to screen without clipboard clipboard clipboard or screen
PWDSH_ECHO character used to echo password input * any valid character
PWDSH_SAFE safe directory name safe any valid string
PWDSH_INDEX index file name pwd.index any valid string
PWDSH_BACKUP backup archive file name pwd.$hostname.$today.tar any valid string
PWDSH_PEPPER file containing "pepper" value, see Detail 1 unset (disabled) any valid file path

See config/gpg.conf for additional GnuPG options.

Also see drduh/Purse - a fork which integrates with YubiKey instead of using a passphrase.

Details

  1. The "pepper" is an additional string appended to the main passphrase to improve its strength. When the PWDSH_PEPPER option is enabled, a secret value is generated and displayed once, then saved to the respective file.

    The pepper should be written down (can be transcribed with either passphrase.html or passphrase.csv template) and stored in a durable location for backup.

    It is the opinion of the author this feature allows the use of a more memorable, weaker main passphrase without compromising overall security, provided the pepper is backed up separately from the safe.

    Warning The pepper file is not included in backup archives - without the pepper, the safe will not be accessible with the main passphrase alone! This feature is opt-in and the pepper has no effect unless explicitly enabled.

pwd.sh's People

Contributors

drduh avatar juergenhoetzel avatar robbydyer avatar ncjones avatar mrbalihai avatar comradesmith avatar eliedeloumeau avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.