Skip to content

Getting Started

Anton van Assche edited this page Oct 28, 2022 · 17 revisions

Dependencies

  • bash >= 3.0

Password encryption:

  • gpg or gpg2

Clipboard support:

  • xclip or xsel

Synchronization support:

  • rsync

Installation

Generating your GPG key

Before you install BashPass, you'll have to generate a GPG key. Run the following command in your terminal to start key generation process:

$ gpg --full-generate-key

Once you run this command, you'll be asked to select a encryption protocol. Select the first option (RSA).

Please select what kind of key you want:
   (1) RSA and RSA
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
   (9) ECC (sign and encrypt) *default*
  (10) ECC (sign only)
  (14) Existing key from card
Your selection? 1

Now you'll be prompted to choose a keysize. The default option (3072) is fine.

RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (3072)
Requested keysize is 3072 bits

After selecting the keysize, you'll be asked how long you want the key to be valid. The default option 1 (key does not expire) is fine.

Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y

Now it's time to set a name for the key. This can be anything (example: BashPass).

Real name: Bashpass

Once you've set a name for the key, it's time to set the email address, this is important to remember, you'll need this later to configure BashPass.

Email address: example@gmail.com

The final step to generate your GPG key is to set a comment, this isn't needed but can be useful in case you have more than one GPG key on your computer. After this just confirm the settings and you're done.

Comment: BashPass encryption key

Now your key will be generated. Once this is done you'll see something like this:

pub   rsa3072 2022-04-22 [SC]
      86F27E3CAA49BB273653B39763BBB2BD91082EE1
uid           [ultimate] Bashpass (Key to use BashPass) <example@gmail.com>
sub   rsa3072 2022-04-22 [E]

Note you can see the key fingerprint (86F27E3CAA49BB273653B39763BBB2BD91082EE1), this string contains the key ID. This are the last 8 characters (91082EE1) of the fingerprint. This part is important to remember, you'll need this later to configure BashPass (see: Post installation).

Installation using the installer (recommended)

Once you have generated your GPG key, it's time to install BashPass. For this you can clone the repo and run the install.sh script or the simple one-liner below. This command will download the latest version of BashPass and install it for you:

$ bash -c "$(wget -qO - https://raw.githubusercontent.com/AntonVanAssche/BashPass/master/scripts/install.sh)"

If that fails, you probably don't have wget, so try curl:

$ bash -c "$(curl -so - https://raw.githubusercontent.com/AntonVanAssche/BashPass/master/scripts/install.sh)"

If both options fail, you probably have neither wget nor curl, so try installing one of them and then try running the one-liners again. You can check if you have one of them installed by running command -v wget or command -v curl, this should return the path where the binary is located.

Installation using the tarball

An alternative to running the installer is to manually install BashPass using the tarballs on the release page. Follow the instructions below to manually install BashPass. First you need to download the tarball, this can be done by using your browser of choice or by running the commands below:

NOTE: Replace the X.X (example: 2.0) with the corresponding version number in all commands below.

$ wget -O BashPass-X.X.tar.gz https://github.com/AntonVanAssche/BashPass/archive/refs/tags/X.X.tar.gz
$ wget -O BashPass-X.X.tar.gz.asc https://github.com/AntonVanAssche/BashPass/releases/download/X.X/BashPass-X.X.tar.gz.asc

The provided tarballs are signed with the following PGP key: AB592CC1A4D17E654ED55FE83FF8016D27683E3E. A copy of this public key can be found on the release page. This key allows you to verify the tarball. Although this step isn't required, it is recommended. If you do decide to verify the tarball you can import the PGP key by using this command:

$ gpg --keyserver keyserver.ubuntu.com --recv-keys 0x3ff8016d27683e3e

Once the PGP key is imported, you can verify the tarball. This can be done with this command:

$ gpg --verify BashPass-X.X.tar.gz.asc

The output should look like this:

gpg: assuming signed data in 'BashPass-2.0.tar.gz'
gpg: Signature created Sat April 23 18:37:51 2022 CEST
gpg: Use RSA key AB592CC1A4D17E654ED55FE83FF8016D27683E3E
gpg: Good signature of "Anton Van Assche (git) <vanasscheanton@gmail.com>" [unknown]

Now it's time to extract the tarball, you can do this with the following command:

$ tar -xvzf BashPass-X.X.tar.gz

Once the tarball is extracted, it is time to create the necessary folders and copy all the files to the corresponding folder. To do so run the commands below:

$ mkdir -p ~/.config/bashpass/
$ mkdir -p ~/.local/share/bashpass/
$ mkdir -p ~/.local/bin/
$ cp -r BashPass-X.X/bashpass ~/.local/bin/
$ cp -r BashPass-X.X/config/ ~/.config/bashpass/

Post installation

After installation, you'll have to add .local/bin to your PATH variable to use BashPass. Add the following line in your .bashrc file.

export PATH="$HOME/.local/bin:$PATH"

When you start BashPass for the first time you'll be prompted with the question to enter the key ID of the key you generated (see: Generating your gpg key). After entering the name a you'll be asked to enter the e-mail address you've used to generate the key.

Enter the key ID of the GPG key you want to use: 91082EE1
Enter the email address you created the gpg key with: example@gmail.com

Updating

To update BashPass to the latest version, you can clone the repo and run the update.sh script or the simple one-liner below. This command will download the latest version of BashPass and install it for you:

$ bash -c "$(wget -qO - https://raw.githubusercontent.com/AntonVanAssche/BashPass/master/scripts/update.sh)"

If that fails, you probably don't have wget, so try curl:

$ bash -c "$(curl -so - https://raw.githubusercontent.com/AntonVanAssche/BashPass/master/scripts/update.sh)"

If both options fail, you probably have neither wget nor curl, so try installing one of them and then try running the one-liners again. You can check if you have one of them installed by running command -v wget or command -v curl, this should return the path where the binary is located.

Uninstalling

To uninstall BashPass, you can clone the repo and run the uninstall.sh script or the simple one-liner below. This command will remove your current installation of BashPass:

$ bash -c "$(wget -qO - https://raw.githubusercontent.com/AntonVanAssche/BashPass/master/scripts/uninstall.sh)"

If that fails, you probably don't have wget, so try curl:

$ bash -c "$(curl -so - https://raw.githubusercontent.com/AntonVanAssche/BashPass/master/scripts/uninstall.sh)"

If both options fail, you probably have neither wget nor curl, so try installing one of them and then try running the one-liners again. You can check if you have one of them installed by running command -v wget or command -v curl, this should return the path where the binary is located.

Clone this wiki locally