Show Asterisks for Password input in Linux/Mac terminal

Whenever you are prompt to enter your password in your linux/mac terminal you cannot see the number of characters typed i.e. you don’t get any visual feedback so you may sometimes mess up your password. with the simple steps below you can view asterisks (*) for your entered password.


1. first enter this command in your terminal

sudo visudo

2. a file /etc/sudoers.tmp will open with your default text editor. i am running Ubuntu OS and nano is the default text editor in ubuntu

now find the following line

Defaults      env_reset

3. and add ,pwfeedback at the end of that line so that it looks like this

Defaults      env_reset,pwfeedback

4. now press Ctrl+O (to save file) and hit enter then press Ctrl+X to exit the editor.

Note: step 4 depends upon your default editor (nano in this case)
In mac the default editor happens to be vim. so vim users may need to learn a few vim editing basics.

Leave a Reply

Your email address will not be published.