Lets you display asterisks when entering passwords in the terminal

 

Guided reading When you enter a password in a web browser or any GUI login, the password is marked with asterisks******** or dots ••••••••••••• . This is a built-in security mechanism to prevent users near you from seeing your password. But when you enter your password in the terminal to perform any sudo or su administrative tasks, you won't see asterisks or dots when you enter your password. It won't have any visual indication of entering a password, nor will there be any cursor movement, nothing. You don't know if you typed all the characters. You will just see a blank screen!

Lets you show asterisks when you enter a password in the terminal Lets you show asterisks when you enter a password in the terminal

As you can see in the picture above, I have entered the password but there is no indication (asterisk or dot symbol). Now, I'm not sure if I entered all the passwords. This security mechanism also prevents people near you from guessing the password length. Of course, this behavior can be changed. That's what this guide has to say. It's not difficult. Read on.

Show asterisks when you enter password in terminal

To display asterisks when entering passwords in the terminal, we need to make some small changes in /etc/sudoers . It is a good idea to backup this file before making any changes. To do this, just run:

sudo cp /etc/sudoers{,.bak}

The above command backs up /etc/sudoers to the name /etc/sudoers.bak. You can restore it in case you make a mistake after editing the file.

Next, edit /etc/sudoers with the following command:

sudo visudo

Find the following line:

Defaults env_reset

Lets you show asterisks when you enter a password in the terminal Lets you show asterisks when you enter a password in the terminal

Add an extra word ,pwfeedback at the end of the line, as shown below.

Defaults env_reset,pwfeedback

Lets you show asterisks when you enter a password in the terminal Lets you show asterisks when you enter a password in the terminal
Then, press CTRL + x and y to save and close the file. Restart the terminal for the changes to take effect.

Now, when you enter your password in the terminal, you will see asterisks.
Lets you show asterisks when you enter a password in the terminal Lets you show asterisks when you enter a password in the terminal

If you're uncomfortable with not seeing your password when you type it in the terminal, this little trick will help. Note that other users can predict the length of your password when you enter your password. If you don't mind, change it as above to make your password visible (as an asterisk, of course!).

via: https://www.ostechnix.com/display-asterisks-type-password-terminal/

Author: SK  Translator: geekpi  Proofreading: wxy

 This article is originally compiled by  LCTT , and launched by Linux China  with honor

The original text comes from: https://www.linuxprobe.com/display-asterisk-password.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324452946&siteId=291194637