Blog

Enable Password Asterisks in Ubuntu Terminal

Linux5 June 2024

Whenever you use sudo in the Ubuntu terminal, you will be asked to enter your user password, unless you are using biometric authentication. By default, the terminal provides no feedback as you type your password, which can be frustrating if you're unsure whether you've typed it correctly. Fortunately, enabling password feedback with asterisks is straightforward. Follow these simple steps, and in just a few minutes, you’ll have visual confirmation while typing your password.

Why Should you Enable Password Asterisks?

While the lack of feedback when typing passwords is a security feature designed to prevent shoulder surfing, many users prefer to see some indication that their keystrokes are being registered. Enabling password feedback in the form of dots or asterisks, like in this case, can enhance the user experience without significantly compromising security, especially in a private or controlled environment.

How to Show Password Asterisks in the Terminal

You are only a few steps away from solving this issue. Here’s how you can enable password asterisks in the Ubuntu terminal:

  1. Open a New Terminal Window

    Press Ctrl + Alt + T on your keyboard to open a new terminal window, or search for "Terminal" in your applications menu and launch it.

  2. Edit the sudoers file using visudo

    Type the following command, then press Enter:

    sudo visudo
    

    This command opens the sudoers file, which controls the behavior of the sudo command. The visudo command safely edits the sudoers file and checks for syntax errors.

  3. Locate the default settings

    In the editor, use the arrow keys on your keyboard to navigate through the file. Look for the following line:

    Defaults env_reset
    
  4. Modify the line to include password feedback

    Move the blinking cursor to the end of the line and modify it to include pwfeedback, as shown below:

    Defaults env_reset,pwfeedback
    

    Ensure there is no space after the comma. This modification tells the system to provide password feedback when using sudo.

  5. Save the changes and exit the editor

    Press Ctrl + X to exit the editor. You will be prompted to save your changes. Type Y to confirm and then press Enter to finalize the changes.

  6. Verify the changes

    To verify that the changes have taken effect, open a new terminal window and run any command with sudo, such as:

    sudo ls
    

    When prompted for your password, you should see asterisks appearing as you type.

Conclusion

Enabling password feedback in the Ubuntu terminal is a simple yet effective way to enhance your user experience. By following these steps, you’ll no longer have to wonder whether you’ve correctly entered your password. This small tweak can make your interactions with the terminal more comfortable and reassuring.

Remember, while enabling password feedback can be convenient, always be mindful of your environment to ensure your password remains secure. Enjoy the improved usability of your terminal commands!