Technology Blog

How To Make Sudo Command Passwords Visible in the Terminal

0

Whenever you use sudo on Ubuntu, the terminal will ask you to enter your user password.

That’s fine. We’re all used to that. It’s a great security measure.

But here’s the rub: the terminal doesn’t offer any sort of visual feedback as you type in your password. This confuses and confounds new users, who are often left uncertain as to whether they’ve entered anything at all!

Here’s a gif of me entering my password:

sudo password gif

Yeah, zero feedback.

It’s a small rub, granted. Once you know that the lack of visual indication is by design …you move on with your life and accept it!

But — and it’s a niché but — if it niggles away at you each and every time you’re asked to enter your password; if you’d rather see a few traditional asterisks (stars) sprouted with each keystroke, here’s a quick how to especially for you.

Make ‘sudo’ Password Entry Visible

pwfeedback

You don’t need to have read this blog for too long to know that I am incredibly typo prone. I type ridiculously fast — faster than my ability allows!

This means I regularly enter my password incorrectly and have to start it over. With some asterisks up on show I can, at least, get some gauge of whether I’ve fudged a few keys too many.

  1. Open a new Terminal window (Ctrl + Alt + T) and enter the following command:
    sudo visudo
  2. Use your keyboard navigation keys (or mouse scroll wheel) to move to the line that reads:
    Defaults env_reset

    Move the square box to the end of this line and add the following text so that it reads:

    Defaults env_reset,pwfeedback
    
  3. Press Ctrl + X to complete the edit, followed by Y and Enter/Return to save the changes entered

That’s all there is to it. The next time you use sudo you’ll see pretty little asterisks appear as you enter your password.

get-the-idea

sudo – now with more presence

Ground-breaking, life-changing, experience-altering this hack isn’t, but it’s nifty to know nonetheless.

Source