How To Show Feedback While Typing Sudo Password in Linux

You’d think it’s trivial that the password feedback would be enabled in the terminal. Recently I found out through this article that I could show the asterisks while when running a command as root. Upon enabling it, I realised how much I actually like the visual feedback, so I decided to make a quick article about it!

Enabling it

Before you continue, make sure to backup the file which were are editing. In case something goes wrong, you can always revert it.

$ sudo cp /etc/sudoers /etc/sudoers_backup

Next, using your preferred text editor edit the file located in /etc/sudoers. For this tutorial, I’ll be using nano.

$ sudo nano /etc/sudoers

Navigate/scroll down and find the following line:

Defaults env_reset

Now append “pwfeedback” to the end of this line, it should look like this:

Defaults env_reset,pwfeedback

Save and exit and once done, type reset to reset your terminal and apply the changes. By either opening up a new terminal, run a command that requires root, eg: sudo dnf upgrade and enjoy!

Having visual feedback is awesome. Not only is it more satisfying to type the password, sometimes I press the wrong key and when I go to pressing backspace, I often hold it longer than I should. Now I can see exactly how many characters I’ve entered.

Leave a comment

Your email address will not be published. Required fields are marked *

Blue Captcha Image
Refresh

*