When you run sudo, you're changing the effective user and/or group ID of a process call. Sudo defaults to the
root user, but can use other users and groups as well (see the
-u flag, for example).
root user is the system's default superuser, but the choice of name is a convention rather than a hardcoded requirement. Don't change it, though, unless you are a masochist.
UID 0 is a Built-in Superuser
You're looking at this backwards. Root is an instance of a superuser (e.g. a user with elevated system privileges), but there can be any number of superusers on a Linux or Unix system.
root just happens to be the expected name of the user with a real ID of 0. That user ID (UID) is hardcoded into the kernel and receives special permissions on *nix systems.
The default superuser group (e.g.
root on most Linux distros,
wheel on most BSD derivatives) can contain other users too, which then have access to things with the relevant read, write, execute permissions set in the group bits of the mode. For example:
-rw-rw-r-- 1 root root 6804 Aug 17 2018 /etc/passwd
This file is readable and writable by the root user, as well as anyone in the root group.
Various utilities like sudo or SGID binaries can provide other users with an effective UID (EUID) or effective GID (EGID) that allows them to perform privileged operations. While not recommended, you can also have more than one user with the same UID, so anyone in /etc/passwd with a UID of 0 is effectively root as well, even if the account names are different. Some BSDs have historically included a toor user with a real UID of 0, along with the standard root user.
You can even rename your root account to something else, if you like. That's generally a bad idea because many scripts and utilities expect the first account with UID 0 to actually be named
root, and often use the account's name instead of its UID or GID to set permissions. For example, the following lines are usually equivalent:
chown 0:0 /etc/passwd
chown root:root /etc/passwd
However, while the kernel doesn't care if you rename the
root account to
toor or even
luser, you can generally expect things to break if you don't have your first superuser account named
root with a real ID of 0. Think of it as a de facto portability standard, for all practical purposes.
The Default Superuser Group
Most Linux systems use
root for the name of the default superuser group. User
root is a member of this group. The group is usually assigned a group ID (GID) of 0, but this isn't enforced by the kernel.
On BSD-based systems like macOS, the default superuser group is generally
wheel instead of
root. This difference can crop up in cross-platform scripting, but isn't as likely to cause unpleasant surprises as a renamed root user.