How to Show Asterisks While Typing Sudo Password in Linux?

LinuxOperating SystemSoftware & Coding

When we use sudo along with a command, we are required to give the password in the next step. But when we start entering the password, we do not see anything displaying on the screen. The screen after the colon symbol remains blank. It creates a difficulty in knowing, how many characters we have entered. In thei article we will see how we can display asterisks for every character of the password entered.

The below screen shows a command with sudo clause to copy a file. As you can see the screen asks for password but nothing is displayed when the password is entered.

Running the above code gives us the following result −

Edit the sudoers

Next we edit the /etc/sudoers file and add pwfeedback. This makes the asterisks visible when the password is enetered. After the file is edited and saved, we type reset command for the effect to take place.

Run sudo Again

Now when we run the same cp command again involving sudo, we see that the asterisks appear when we put the password.

raja
Published on 14-Feb-2020 10:51:05
Advertisements