Updated: 9 November 2026 · Applies to: sudo 1.9.15p5 on Ubuntu 24.04, sudo 1.9.16p2 on Debian 13, sudo on AlmaLinux 9, sudo-rs 0.2.13 on Ubuntu 26.04

To make sudo show an asterisk (*) for every character of your password, add Defaults pwfeedback to the sudoers configuration with visudo. The quickest safe way is a small file of its own in /etc/sudoers.d/. On Ubuntu 26.04 you do not need to do anything: its new sudo (sudo-rs) already shows asterisks.

By default the classic sudo shows nothing at all while you type, so many people think the terminal has frozen. It has not: sudo is reading your password with the echo turned off. The pwfeedback option only adds feedback. sudo has no setting that prints the password itself in plain text.

Enable asterisks for the sudo password

  1. Log in as a user who can already use sudo (or as root).
  2. Create a new sudoers drop-in file with visudo, which checks the syntax before it saves:
    sudo visudo -f /etc/sudoers.d/pwfeedback
  3. Add this single line, then save and exit (in nano: Ctrl+O, Enter, Ctrl+X; in vi: Esc, :wq):
    Defaults pwfeedback
  4. Check the whole sudo configuration:
    sudo visudo -c
    Output on Debian 13:
    /etc/sudoers: parsed OK
    /etc/sudoers.d/README: parsed OK
    /etc/sudoers.d/pwfeedback: parsed OK
  5. Clear the cached login so sudo asks for the password again, and test it:
    sudo -k; sudo whoami

Output on Ubuntu 24.04 with a nine-character password (the same on Debian 13 and AlmaLinux 9):

[sudo] password for alice: *********
root

Without the setting, the same prompt stays blank:

[sudo] password for alice:
root

The change applies straight away to every user on the server. You do not need to restart anything or log out.

Prefer to edit the main sudoers file?

You can also run sudo visudo and add Defaults pwfeedback on its own line below the other Defaults lines, or add it to an existing line with a comma, for example:

Defaults        env_reset,pwfeedback

The separate file in /etc/sudoers.d/ is easier to find and undo later. On Debian and Ubuntu the main file already contains @includedir /etc/sudoers.d, and on AlmaLinux and Rocky Linux it contains #includedir /etc/sudoers.d, so files there are read automatically.

Always use visudo, never a plain editor. If a sudoers file has a typo, sudo refuses to run for everyone. If that has already happened, see how to fix a broken sudoers file.

Ubuntu 26.04: asterisks are on by default

Since Ubuntu 25.10, sudo is provided by sudo-rs, a new implementation written in Rust (see sudo-rs in the Ubuntu Server documentation). On Ubuntu 26.04 it shows asterisks without any change. Its prompt also looks different. Output on Ubuntu 26.04 with no sudoers changes:

[sudo: authenticate] Password: *********
root

Check which sudo you have with:

sudo --version

Ubuntu 26.04 prints sudo-rs 0.2.13-0ubuntu1.2; Ubuntu 24.04 prints Sudo version 1.9.15p5.

Turn the asterisks off again

On Ubuntu 24.04, Debian and AlmaLinux, delete the drop-in file (or remove the word from your Defaults line):

sudo rm /etc/sudoers.d/pwfeedback

On Ubuntu 26.04 the feedback is the default, so you switch it off with the negated option. Create the file with sudo visudo -f /etc/sudoers.d/pwfeedback and put this line in it:

Defaults !pwfeedback

We tested both: with !pwfeedback the Ubuntu 26.04 prompt goes back to showing nothing while you type.

Is it safe to show asterisks?

Mostly a matter of taste. The sudoers manual warns that an onlooker can count the asterisks and learn the length of your password. On a shared office screen or while screen sharing, that is a small leak; on your own laptop it hardly matters. A long password makes the length less useful to anyone watching.

Related sudo settings

Official documentation: sudoers manual (pwfeedback).

Related services

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.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket