Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month, online, via Jitsi Meet.

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Password app



Here is my password app for Linux. It's free. :-)

1. Create a text file with three columns: username, password, and any
notes you want to add. Use a single tab character as a column separator.

2. Encrypt the file with GnuPG.

3. Write a script to run "gpg -d | grep -i" on your encrypted file to
locate matching lines. (So any command-line arg can be a search key.)
Use /usr/bin/cut to extract the first column and pipe it to "xclip
-selection clipboard", and the second column to "xclip -selection
primary".

4. Run the script with any arguments as search keys:

   $ myscript amazon.com

5. Now, "right-click + Paste" will paste your username, and middle
mouse button will paste your password.

6. If you get tired of typing your passphrase over and over, use
gpg-agent or similar.

Here's my script, which also echoes the username and notes (third
column) on screen. Enjoy, modify, share, etc. Public domain.

------------8<----------------- cut here ----------------8<------------------
#!/bin/bash
if [ -z "$DISPLAY" ]
then
  echo "$0: no DISPLAY, cannot use xclip"
  exit 1
fi

PASSFILE=/path/to/your/file.gpg

lines=`gpg -d "$PASSFILE" | /bin/grep -i "$@"`
count=`echo "$lines" | wc -l`
echo
if [ $count -eq 1 ]
then
  username=`echo -n "$lines" | cut -f1`
  password=`echo -n "$lines" | cut -f2`
  notes=`echo -n "$lines" | cut -f3`
  echo "Username = $username"
  echo "$notes"
  echo "Password is in clipboard"
  echo -n "$password" | xclip -selection primary
  echo -n "$username" | xclip -selection clipboard
else
  echo "$count lines found - multiple matches - try again"
fi
------------8<----------------- cut here ----------------8<------------------

--
Dan Barrett
dbarrett at blazemonger.com




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org