Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Linux manage passwords using the password management tool pass

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how Linux uses the password management tool pass to manage passwords". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

For those users who do not want to rely on graphics for password management, the author will describe how to use pass to manage passwords on the command line, a simple tool for managing passwords on the command line.

The password tool is actually a front-end for shell scripting, in which several other tools (such as gpg,pwgen,git,xsel) are called to manage the user's password information using OpenGPG. Each password is encrypted using the gpg tool and stored in the local password repository. Password information can be used through the terminal or through the self-purging clipboard tool.

The password tool is quite flexible and easy to use. You can store each password information in an OpenGPG-protected plain text file and group different password files into multiple categories. It supports bash auto-completion, so you can easily use the TAB key to complete commands or long password names.

Install pass on Linux

Install pass on Debian,Ubuntu or Linux Mint:

$sudo apt-get install pass

$echo "source / etc/bash_completion.d/password-store" ~ / .bashrc

Install pass on Fedora:

$sudo yum install pass

$echo "source / etc/bash_completion.d/password-store" ~ / .bashrc

To install pass on CentOS, first enable the EPEL repository, and then execute the following command:

$sudo yum install pass

$echo "source / etc/bash_completion.d/password-store" ~ / .bashrc

Install pass on Archlinux:

$sudo pac-S pass

$echo "source / etc/bash_completion.d/password-store" ~ / .bashrc

Initialize the local password repository

Before using the password tool, you need to perform an initialization step that includes creating a GPG key pair (if you don't already have one) and a local password repository.

First, create a GPG key pair (that is, public / private key) by following these steps. If you have already created your own GPG key pair, you can skip this step.

$gpg-gen-key

To perform this step, you will be asked the following questions. If you are not sure, you can choose to accept the default answer. As part of key generation, you will create an encrypted password for your key, which is actually the master password when you access any password information stored in the local password repository. After the key pair is successfully created, the created key pair is stored in the ~ / .gnupg directory.

Next, run the following command to initialize the local password repository. Next, enter the associated e-mail address when you created the key pair.

$pass init "gpg-id"

This command creates a password repository in the ~ / .password-store directory.

Use pass to manage passwords at the terminal

Insert new password information

To insert new password information into the local password repository, follow the following command format:

$pass insert "password-name"

Is a proper name that you define and can be graded (such as "finance/tdbank", "online/gmail.com"). In this case, the password information can be stored in the corresponding subdirectory under the ~ / .password-store directory.

If you want to insert password information in multiple lines, use the "- m" option like the following command. Enter the password information in any format you like, and then press Ctrl+D to end.

$pass insert "password-name"-m

View a list of all password names

To see a list of all stored password names, simply enter the "pass" command:

$pass

Retrieve password information from password warehouse

To access the contents of a specific password list, simply use the following command:

$pass "password-name"

For example:

$pass email/gmail.com

You will be asked to enter a password to unlock the key.

If you want to copy the password to the clipboard instead of displaying it on the terminal screen, use the following command:

$pass-c email/gmail.com

When the password is copied to the clipboard, the clipboard will be emptied automatically after 45 seconds.

Generate and store new passwords in the password repository

Using the pass command, you can also generate a new random password that can be used for any purpose. The pass tool will use the pwgen tool to generate a good random password. You can specify the length of the password, or generate a password with or without a symbol.

For example, to generate a 10-character unsigned password and store it in the "email/new_service.com" list:

$pass generate email/new_service.com 10murn

Remove password information

It is easy to remove existing password information:

$pass rm email/gmail.com

This is the end of the introduction to "how Linux uses the password management tool pass to manage passwords". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report