How to use command line to manage passwords in Linux

Source: Internet
Author: User

How to use command line to manage passwords in Linux

In today's popular password-based authentication on the internet, you may need or have used a password management tool to track and manage all the passwords you are using. There are a variety of online or offline services or software tools used to accomplish such things, and these tools, due to complexity, user interface or target environment (such as enterprise or end user) and are different. For example, some are graphical-based password managers developed for end users, such as KeePass (X ).

20 most popular Linux commands, do you agree?

Linux Command cd

Cat for Linux commands

Linux Command alias/unalias

Linux Command Parsing: su root and su-root

Interactive input of Linux commands read

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

The password tool is actually a front end of shell script writing. It calls several other tools (such as gpg, pwgen, git, and xsel) to use OpenGPG to manage user password information. Each password is encrypted using the gpg tool and stored in the Local Password repository. Password information can be used through a terminal or a self-clearing clipboard tool.

The password tool is 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 the command or a long password name.

Install pass on Linux

Install pass On Debian, Ubuntu, or Linux Mint:

  1. $ Sudo apt-get install pass
  2. $ Echo "source/etc/bash_completion.d/password-store" >> ~ /. Bashrc

Install pass on Fedora:

  1. $ Sudo yum install pass
  2. $ Echo "source/etc/bash_completion.d/password-store" >> ~ /. Bashrc

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

  1. $ Sudo yum install pass
  2. $ Echo "source/etc/bash_completion.d/password-store" >> ~ /. Bashrc

Install pass on Archlinux:

  1. $ Sudo pac-S pass
  2. $ 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, which includes creating a GPG key pair (if you do not have one) and a local password repository.

First, create a GPG key pair (Public Key/private key) by following these steps ). Skip this step if you have created your own GPG key pair.

  1. $ Gpg -- gen-key

After performing this step, you will be asked the following questions. If you are not sure, you can accept the default answer. As part of key generation, you will create an encrypted password for your key. This password is actually the master password when you access any password information stored in the Local Password repository. After a key pair is created, the created key pair is stored in ~ /. Gnupg directory.

Next, run the following command to initialize the Local Password repository. Enter the email address associated with the key pair.

  1. $ Pass init <gpg-id>

This command will be in ~ /. Password-store directory to create a password repository.

Use the pass management password on the terminal to insert new password information

To insert new password information into the Local Password repository, follow the command format below:

  1. $ Pass insert <password-name>

Is the proprietary name you define and can be classified (such as "finance/tdbank", "online/gmail.com "). In this case, the password information can be stored in ~ /. 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 press Ctrl + D.

  1. $ Pass insert <password-name>-m

 

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.