Information
On a Linux system, the user ID (UID) 0 is the superuser identity: the kernel grants any account assigned UID 0 complete, unrestricted control of the host, regardless of the account's name. The root account holds UID 0 by default.
Limiting UID 0 to the single default root account ensures privileged access is accountable and cannot be silently obtained through a second, easily overlooked superuser identity. Administrative access should be performed through an unprivileged account using an approved escalation mechanism, as described in the recommendation covering restriction of the su command.
Solution
- Run the following command to reassign any account other than root that has UID 0 to a new, unused UID (and update ownership of that account's files):
# usermod -u <NEW_UID> <username>
Example:
# usermod -u 1234 bsmith
- If the root account's UID is not 0, run the following command to reset it:
# usermod -u 0 root