Show‐Sudo‐Password‐Feedback - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Enable Asterisk (*) Feedback When Typing sudo Password in Linux Terminal
By default, when you run a sudo command in most Linux distributions, nothing appears on screen as you type your password (no characters, no asterisks). This is a deliberate security feature to prevent shoulder-surfing from revealing the password length.
Many users prefer visual feedback (showing * for each character typed). This is easy to enable using the pwfeedback option in the sudoers file.
Note: In very recent Ubuntu versions (26.04+), or if using sudo-rs (Rust-based sudo), this may already be enabled by default.
Step-by-Step Instructions
-
Open the sudoers file safely
Always usevisudo— it checks syntax before saving to prevent locking yourself out.sudo visudo(You will be prompted for your password — nothing will show as you type it yet.)
-
Locate the relevant line
Look for this line (usually near the top of the file):Defaults env_reset- It may appear with tabs/spaces or slightly different formatting.
- If you don't see it, you can add a new line at the end of the file instead.
-
Enable password feedback
Modify the line to include,pwfeedback(no space before or after the comma):Defaults env_reset,pwfeedbackExample of how it should look:
# # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. # Defaults env_reset,pwfeedbackOptional customization (advanced):
You can change the feedback character (default is*):Defaults pwfeedback="*" Defaults pwfeedback="." Defaults pwfeedback="-" -
Save and exit
- If using nano (default on many distros):
Ctrl+O→Enter→Ctrl+X - If using vi/vim:
PressEsc, then type:wqand pressEnter
- If using nano (default on many distros):
-
Apply the change
-
Close and reopen your terminal, or open a new tab/window.
-
Test it:
sudo ls
You should now see an asterisk (
*) for each character you type when prompted for your password. -
Reverting the Change
To disable asterisks again, use sudo visudo and remove ,pwfeedback from the line (or delete the line if you added it separately).
Security Considerations
- Showing feedback reveals password length — a minor risk in most desktop/home scenarios, but something to consider in shared or high-security environments.
- Always use
visudo— never edit/etc/sudoersdirectly. - This setting only affects the terminal-based
sudoprompt (not GUI password dialogs).
Troubleshooting
- Nothing happens? Make sure there are no spaces around the comma in
env_reset,pwfeedback. - Syntax error on save?
visudowill warn you — fix the line and try again. - Using sudo-rs? Recent versions show asterisks by default — no change needed.
- Still no feedback? Log out and back in, or reboot (rarely needed).
Enjoy a slightly friendlier sudo experience!
Questions or issues? Feel free to open a discussion or issue on this repo.
This format uses standard GitHub Markdown features: headings, code blocks, bold/italics, numbered lists, and notes for readability. It should render nicely on GitHub Wiki pages. Let me know if you'd like to add screenshots (you can upload them to the wiki and link/embed them).