Created
May 9, 2017 04:58
-
-
Save jeremytregunna/fa1bbc1cf178ac5683f676cecb00742a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export PASS_RECIPIENT="you@your-gpg-identity.com" | |
| export PASS_HOME=$HOME/.secret-or-some-other-place-you-want-to-keep-the-files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ X"$1" = X"-h" ]; then | |
| echo "Usage: pass-get <key>" | |
| echo " Fetches and decrypts a password for the thing at key." | |
| exit 0 | |
| fi | |
| passwd_file=$PASS_HOME/$1.gpg | |
| if [ -f $passwd_file ]; then | |
| gpg -q --no-tty -r $PASS_RECIPIENT -d $passwd_file | |
| else | |
| echo "Couldn't find [ ${passwd_name} ]" | |
| exit 1 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ X"$1" = X"-h" ]; then | |
| echo "Usage: pass-set <key> <pass>" | |
| echo " Stores a password `pass` for a given key `key`." | |
| exit 0 | |
| fi | |
| if [ ! -d "$PASS_HOME" ]; then | |
| mkdir -p $PASS_HOME | |
| fi | |
| passwd_file=$PASS_HOME/$1.gpg | |
| read -sep "Enter password: " pw | |
| echo | |
| echo $pw | gpg -r $PASS_RECIPIENT -a -o $passwd_file -e - | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment