Checks / Users

An account other than root has UID 0

Check
users.uid0
Severity
critical
Runs
on the server, in the daily run of the agent
Looks at
/etc/passwd lines with UID 0 other than root
Updated 26 Nov 2026

What the check looks at

The agent reads /etc/passwd and reports every account other than root whose user ID (the third field) is 0. It reports the account names only.

Why it matters

The kernel knows users by number, not by name. An account with UID 0 has every power of root, whatever it is called, and its logins and commands show up under a name that does not look like root. Adding a second UID 0 account (often named toor, admin or after a system service) is a known way to keep access to a compromised server. Current distributions do not create such accounts.

How to fix it

List the accounts:

awk -F: '$3 == 0 { print $1 }' /etc/passwd

Only root should appear. For any other name, find out where it came from before you remove it:

sudo grep -n '^toor:' /etc/passwd /etc/shadow
sudo journalctl _COMM=useradd _COMM=usermod --no-pager | tail     # systemd distributions
sudo last toor | head

If you did not create it, treat the server as compromised. Removing the line does not remove whatever else the attacker changed. Keep a copy of the disk for analysis if you need one, rebuild the server from a clean image, restore data from a backup you trust, and change the credentials that were on it.

If it is a leftover admin alias, give the person a normal account with sudo and remove the alias. userdel refuses at first, because UID 0 processes are running, and -f removes the entry anyway. Do not add -r: the home directory of such an alias is often /root, and -r would delete it.

sudo userdel -f toor

The command is the same on Debian, Ubuntu, RHEL, Rocky Linux and AlmaLinux. On Alpine, userdel comes with the shadow package (apk add shadow). In tests on Debian 12 and 13, Rocky Linux 9 and Alpine 3.24, userdel -f printed userdel: user toor is currently used by process 1, removed the entry, and left /root in place.

How to check the fix

awk -F: '$3 == 0 { print $1 }' /etc/passwd
grep -c '^toor:' /etc/shadow /etc/group

The first command must print only root, the second 0 for both files.

When a warning is fine

Practically never. If a tool asks for a second UID 0 account, give it a regular account with a narrow sudo rule instead.

Sources