How to Enable Asterisks While Typing Passwords In Linux Terminal?

asterisks in terminal_1

Most of the mobile applications or web apps we use in our day to day life display either dots(…..) or Asterisks(****) when we type in the login credentials in the password field. This will prevent the details from password snoopers and hide our passwords from the people around us.

This is definitely a good basic security measure. If you are using a long password things become worse as you don’t know where you have mistyped the password. So, to avoid this inconvenience some apps allow users to view password that they have entered into the text field to make sure they have typed it correctly.

But Linux is totally different. Only a true Linux user will understand the capabilities of the Linux Operating System. At present, there are several Linux distributions with advanced GUI’s that allow any beginner to get started with Linux.

If you are a Linux expert are a Linux system admin then you must be aware of the convenience in using Linux through the Command Line Interface(CLI) or Terminal. Using Linux through CLI is quite fun and interesting as it helps you understand more about the operating system.

While using terminal then you might have noticed that when a normal user runs the sudo command to gain superuser privileges, he/she is asked for a password, but no visual feedback is seen by the user while typing the password.

It will be difficult to identify if anything is getting typed or not. Also, there isn’t any visual feedback that notifies you if anything is being typed or not.

If you had experienced any such troubles, then they no longer bother you as we will show you how to display asterisks as feedback when you type the password in Linux terminals.

Recommended:  Microsoft Is Now The Premium Sponsor of Open Source Initiative(OSI)

You can check the below screenshot in which no visual feedback is displayed when the password is typed. This can be easily enabled by modifying “sudoers” file. Here is how to do it:

Enabling Asterisks For Passwords in Terminal:

asterisks in terminal_2
  • Before editing the sudoers file you need to back up the file. The file is located in at the following path: etc/sudoers
  • You can do this by using a file manager(requires root access) or you can simply backup by running the below command in terminal.

$ sudo cp /etc/sudoers /etc/sudoers.bak

  • Now open it for editing by running $ sudo visudo command, in the terminal.
  • Once it is opened, search for the line that contains Defaults env_reset attribute.
  • Append pwfeedback to it, so that it looks like the one shown in the screenshot.
  • Finally, save the edits and close it.
asterisks in terminal_3

To make the changes effective, you need to reset the terminal. Just hit reset and hit enter. That’s it, next when you enter the password in terminal, you will be able to a visual feedback (****) every time on the terminal, as shown in the following screenshot.

If you feel any difficulties in implementing this trick you can reach us through comments and we will assist you. For more latest  Linux news, How To’s and Tricks you can follow us on Facebook.

Was this post helpful?

Ganesh Venigalla

Geek, Passionate, Nerd for Tech!

You may also like...

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

How to Enable Asterisks While Typing Passwords In Linux Terminal?

by Ganesh Venigalla time to read: 2 min