How To Display Asterisks When You Type Password In Linux Terminal

Terminal is a crucial tool for Linux admin, which allow them to perform any kind of task in a secured manner.

When you type password in any of the GUI portal that will be masked as asterisks like (*******).

It’s a built-in security mechanism that prevent others to view your password when you are typing.

But, in Linux terminal it doesn’t show anything when you enter the password. It’s common in Linux terminal and most of us adapted this feature.

There are the chances that you may type your password wrongly multiple times, which can be really irritating you.

To avoid this situation, you need to get an Asterisks output when you type password.

It shows you, how many characters that you have entered.

It helps you to re-check that you have missed any characters or typed any extra characters in password.

In this article, we will tell you how you can enable this feature in Linux Operating System.

I have tested this on Ubuntu 18.04, CentOS 6/7 and Manjaro and it’s working fine. I hope, it will work on these clone as well without any issues.

By default you will be getting the below output when you entering the password.

$ sudo apt update
[sudo] password for daygeek: 

How to Display Asterisks When You Type Password In Linux Terminal?

To do so, you need to append the pwfeedback word in /etc/sudoers file.

It’s a best practices to backup a files before making any changes in Linux. So, backup the sudoers file before appending anything on it.

This will help you to restore it to previous state without any damage, if something goes wrong.

$ sudo /etc/sudoers /etc/sudoers.bk

Once you done the backup, you are ready to go.

It can be done in two ways. Either append the following word pwfeedback in the file as shown below or append Defaults pwfeedback as a new line at end of the file.

# visudo

Defaults        env_reset,pwfeedback

or

# visudo

Defaults        pwfeedback

Once you done the changes, just save and exit the file.

Finally we can test this out by calling any commands with sudo as shown below.

$ sudo pacman -Syu
[sudo] password for daygeek: *********

We are preparing all the articles in-depth to understand by all level of Linux administrators. If the article is useful for you, then please spend less than a minute to share your valuable comments in our commenting section or spread this on Social media.

Please stay tune with us…Good Luck.

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...