SEARCH

How-To Geek

How to Make Password Asterisks Visible in the Terminal Window in Linux

00_lead_image_asterisks_for_password

When you run a command using sudo in Linux, the Terminal prompts you to type in your password with no visual feedback as you type. We’ll show a quick tweak that will show asterisks (*) when you type in your password in the Terminal.

NOTE: When we say to type something in this article and there are quotes around the text, DO NOT type the quotes, unless we specify otherwise.

We will open the “/etc/sudoers” file and change a setting to customize the length of the grace period. To begin, press Ctrl + Alt + T to open a Terminal window. Type the following command at the prompt and press Enter.

sudo visudo

Type your password when prompted and press Enter. Notice that no asterisks are displayed when you enter your password.

01_opening_visudo_file

A file opens directly in the Terminal window using the Nano text editor. Use the arrow keys on your keyboard to move the cursor to the end of the following line:

Defaults         env_reset

RELATED ARTICLE
Change the Default Editor From Nano on Ubuntu Linux
Many of the utilities in Ubuntu Linux use a text editor to allow you to edit configuration options and files.... [Read Article]

IMPORTANT: Never edit the sudoers file with a normal text editor. Always use the visudo command as described here. If the sudoers file has improper syntax, you will be left with a system where it’s impossible to obtain elevated or root privileges. The visudo command opens a text editor like you would with normal text files, but the command also validates the syntax of the file upon saving it. This prevents configuration errors in the sudoers file from blocking sudo operations, which could be your only method of obtaining root privileges.

Traditionally, Linux uses vi as the default editor, but Ubuntu has chosen to use Nano. If you would rather use vi as the default text editor in Ubuntu, rather than Nano, see our article.

02_env_reset_line_original

Change the line by adding “,pwfeedback” to the end of the line.

Defaults                 env_reset,pwfeedback

03_env_reset_line_revised

You can also press Enter after “env_reset” to make a new line and type the following on the new line:

Defaults                 pwfeedback

NOTE: The space between “Defaults” and “pwfeedback” should be a tab.

04_env_reset_line_revised_separate_line

Once you have made the change, press Ctrl + X and type a “y” in response to the question that displays at the bottom of the window to save your changes.

05_saving_and_exiting

You will be asked for the File Name to Write at the bottom. Press Enter to accept the default.

06_file_name_to_write

You are returned to the command prompt. To close the Terminal window, type “exit” at the prompt and press Enter. You can also click the X button in the upper-left corner of the window.

07_closing_terminal

The next time you open a Terminal window and run a command using sudo, you will see asterisks when entering your password at the prompt.

08_asterisks_for_password

NOTE: You must close the Terminal window and open it for the change to take place.

Lori Kaufman is a freelance technical writer who likes to write geeky how-to articles to help make people's lives easier through the use of technology. She loves watching and reading mysteries and is an avid Doctor Who fan.

  • Published 08/4/14