Updated: 28 September 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9
By default, sudo shows nothing while you type your password. You can make it show an asterisk for each character. This works on Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9.
- Open a new sudoers file safely with
visudo -f /etc/sudoers.d/pwfeedback. - Add the line
Defaults pwfeedbackand save. - Open a new terminal and run
sudo -k; sudo trueto test.
To undo it, delete the file: rm /etc/sudoers.d/pwfeedback.
Note: Always edit sudoers files with visudo: it checks the syntax before saving, so a typo cannot lock you out of sudo. The asterisks also show how long your password is to anyone watching your screen.
Other useful sudo settings
Put each in its own file under /etc/sudoers.d/ with visudo -f:
Defaults timestamp_timeout=15: minutes before sudo asks for the password again (0 = every time).Defaults passwd_tries=3: attempts before sudo gives up.Defaults insults: a joke message after a wrong password (harmless, but not for production servers).
Check which rules apply to you with sudo -l.
Ucartz services for this topic
- KVM VPS hosting: NVMe SSD and full root access, with Free Basic Managed Support.
- Unmanaged dedicated servers: full root access and free IPMI KVM, with Free Basic Managed Support.
- Linux server management: hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.
