Linux Mint

How to Manage Passwords from the Command Line on Linux Mint 21

These days almost all accounts use password-based authentication and thus having a password-management tool is becoming a necessity. Those who don’t want to use GUI-based tools can always use simple command line utilities for storing their passwords. These tools store the notes, URLs, titles, and passwords in encrypted files. These tools create files in categories so users can easily store and identify them. In this tutorial, we will discuss simple and portable command-line password-storing tools.

How to Manage Passwords from the Command Line on Linux Mint 21

The two simple, portable, flexible, and easy-to-use command line utilities for managing passwords on Linux Mint 21 are:

    • pass
    • kpcli

1: Using pass Utility to Manage Passwords on Linux Mint 21

pass is the simple utility for storing the user’s password on a Linux system. It stores information about your passwords in an open GPG-protected text file and uses the terminal as its primary interface. It allows users to create multi-line entries, below are the steps for installing and setting up the Pass on your Linux Mint 21:

Step 1: Install pass

The first step is installing the utility on your Linux Mint 21 system via the following command:

$ sudo apt-get install pass

 

Step 2: Create GPG Key

Once you have installed the pass, perform a one-time initialization process of creating a key. This key will be used to encrypt the password of your password store. Execute the below command, once you hit Enter it will ask you a series of questions:

$ gpg --gen-key

 

Step 3: Password Configuration

Now, to start using the pass you must create a local password store. This is done by using the pass init command and your name as an argument:

$ pass init zainab

 

Once the password store is initialized against your name or a key, check the list of stored passwords via the following command:

$ gpg --list-keys

 

Initialized the password with the key generated, if you forget the key just use the above given command:

$ pass init 990FAFA99EB8A50C0F66E77AFC24AD855AA8ED17

 

Step 4: Store a password

Next used the following command to store a password in a password store for the respective email id or any other account whose password you want to save:

$ pass add <email-id/account-username>

 

Step 5: Show and edit password

Once you have set the password, use the following command to see the content of your password store:

$ pass show <email id>

 

Next you can change the password by using the below command:

$ pass edit <email-id/given-account-username>

 

Step 6: Get the Details of your Password Store

Use pass command without any argument to get the details of your password store and it will show all the usernames for which you have save the passwords:

$ pass

 

2: Using kpcli Utility to Manage Passwords on Linux Mint 21

kpcli is the command line password manager tool for Linux systems. You can create a database for storing the passwords of your account and protect them with a single password. It is present in the default repository so install it via the below command:

$ sudo apt-get install kpcli

 

Once the installation is finished, run the kpcli via the following command:

$ kpcli

 

Next, create a database where you will store all your passwords. Execute the below command for creating the database:

$ saveas mypasswordinfo.kdb

 

Create a directory of your own choice, here I am creating a directory of emails for storing the passwords of my email accounts:

$ mkdir emails

 

Use the ls command to verify whether the directory is created or not:

$ ls

 

Switch to directory:

$ cd emails

 
And use the new command for making entries:

$ new

 

Verify the entries via the ls command:

$ ls

 

You can use the below command for viewing the details of your entries:

$ show -f 0

 

Here in the above command 0 is the entry number and -f flag is used to show all the details of the entry, kpcli allows you to edit your entry by using the following command:

$ edit 0

 

Once done, quit the kpcli by executing the below command:

$ quit

 

Enter the following command to reopen the database you just have created for storing your passwords:

$ kpcli --kdb mypasswordinfo.kdb

 

If you need help while using the kpcli you can use the help command after launching the created database:

$ help

 

Conclusion

The password managers in Linux allow you to store the passwords in them and retrieve them through the command line. It is the best option for users who understand SSH remote login. The two best password managing tools including pass and kpcli are discussed in detail in this post. Through these tools you can store your password without depending on GUI on Linux Mint 21.

About the author

Zainab Rehman

I'm an author by profession. My interest in the internet world motivates me to write for Linux Hint and I'm here to share my knowledge with others.