How to use the command 'gopass' (with examples)
The gopass
command is a standard Unix Password Manager for Teams written in Go. It enables users to securely store and manage passwords by encrypting them locally and syncing them across multiple devices. With gopass
, users can initialize configuration settings, create new entries, search for passwords using keywords, sync stores, and more.
Use case 1: Initialize the configuration settings
Code:
gopass init
Motivation: Initializing the configuration settings is the first step to start using gopass
. This command sets up the required directories and files to store encrypted passwords.
Explanation: The command gopass init
creates the necessary structure and files for gopass
to function properly. It initializes the .gpg-id
file, which contains the public GPG key that will be used for encryption and decryption.
Example output:
Initialized empty pass store: /path/to/gopass/root
To unlock the password store in the future, run:
gopass init -p /path/to/gopass/root
Use case 2: Create a new entry
Code:
gopass new
Motivation: Creating a new entry allows users to add a new password to their password store.
Explanation: The command gopass new
prompts the user to enter a passphrase and will then create a new password entry in the password store. The user can provide additional information such as the username, URL, and notes for the entry.
Example output:
Enter passphrase for new entry: ********
Website: example.com
Username: john@example.com
Password: [hidden]
Notes: This is my password for example.com
...
Use case 3: Show all stores
Code:
gopass mounts
Motivation: Showing all stores provides an overview of the mounted password stores, which are the locations where password entries are stored.
Explanation: The command gopass mounts
displays a list of all the mounted stores, including their names and URLs. This information is useful for managing and organizing password stores.
Example output:
stores:
- store_name: git_repo_url
- store_name2: git_repo_url2
...
Use case 4: Mount a shared Git store
Code:
gopass mounts add store_name git_repo_url
Motivation: Mounting a shared Git store allows multiple team members to work collaboratively on managing passwords.
Explanation: The command gopass mounts add
mounts a shared Git store with the specified store name and Git repository URL. This enables team members to sync and access the password store repository, facilitating easy sharing and collaboration.
Example output:
Successfully mounted store 'store_name' from git repository 'git_repo_url'
Use case 5: Search interactively using a keyword
Code:
gopass show keyword
Motivation: Searching interactively allows users to quickly find a specific password entry based on a keyword.
Explanation: The command gopass show
searches for password entries interactively, filtering the results based on the provided keyword. The command presents the user with a selection of matching entries and allows them to select the desired one.
Example output:
Select entry:
1. example.com/email@email.com
2. ...
...
Selected entry: 1
...
Use case 6: Search using a keyword
Code:
gopass find keyword
Motivation: Searching using a keyword is helpful when users want to locate a specific password entry without the need for interactive selection.
Explanation: The command gopass find
searches for password entries using a keyword. It returns a list of matching entries based on the keyword provided.
Example output:
Matching entries:
- example.com/email@email.com
- ...
...
Use case 7: Sync all mounted stores
Code:
gopass sync
Motivation: Syncing all mounted stores ensures that the password store is up to date across devices and with other team members.
Explanation: The command gopass sync
synchronizes all mounted stores, updating the local password store with the latest changes from remote repositories. This ensures that all devices and team members have access to the most recent passwords.
Example output:
Syncing store 'store_name'...
Syncing store 'store_name2'...
...
Use case 8: Show a particular password entry
Code:
gopass store_name|path/to/directory|email@email.com
Motivation: Showing a particular password entry allows users to view the details of a specific password entry.
Explanation: The command gopass
followed by the store name, directory path, or email searches for and displays the details of the matching password entry.
Example output:
Website: example.com
Username: john@example.com
Password: [hidden]
Notes: This is my password for example.com
...
Conclusion
The gopass
command is a versatile password manager that provides various functionalities for securely storing and managing passwords. By utilizing its features such as initializing configuration settings, creating new entries, searching for passwords, and syncing stores, users can effectively protect and access their sensitive information.