Every Linux machine draws one bright line: ordinary users on one side, root — the superuser who can read, change or delete anything — on the other. Working safely means living on the ordinary side and crossing that line deliberately, briefly and on the record. That crossing has a name, sudo, and the user accounts around it are managed with a small set of well-documented tools: useradd, passwd, and the account databases described in the man-pages project. Used together, they give a machine power with a leash — full administrative ability, handed out in measured doses instead of all day, every day.

sudo: borrow root, do not become root
The sudo manual states its purpose plainly: sudo allows a permitted user to execute a command as the superuser or as another user, as specified by the security policy configured in the sudoers file. The normal pattern is simple — prefix one command with sudo, authenticate with your own password, and that single command runs with elevated privilege while your session otherwise stays unprivileged. When the command finishes, so does the elevation.
That design is the opposite of logging in as root or parking in a root shell. A root shell makes every keystroke — including the typo and the pasted command you did not fully read — a root keystroke. sudo shrinks the blast radius to one intentional command at a time, and because you authenticate as yourself, the system logs record who actually asked for the power. The sudo documentation also describes a short credential cache: after a successful authentication, sudo typically does not ask again for a brief window (the timestamp_timeout setting, 15 minutes by default in the upstream documentation). Convenient, and worth knowing — on a shared or unlocked machine, that window is part of your threat model, and sudo -k revokes the cached credentials immediately.
The sudoers file: where the leash is written
Permission to use sudo is not a property of your account alone; it is granted by policy. The sudoers file — documented in the sudoers manual and normally kept at /etc/sudoers, with drop-in files under /etc/sudoers.d/ — decides which users and groups may run which commands, on which hosts, as which target users. A typical grant gives a group, often called sudo or wheel depending on the distribution, the ability to run any command as any user — but the format supports far tighter grants, down to one named user running one named command.
Two rules protect that file. First, never edit it with a plain text editor: the sudo project provides visudo, which edits a temporary copy, checks the syntax before installing it, and locks the file against simultaneous edits. A syntax error in sudoers can lock every administrator out of sudo at once, and visudo exists precisely to make that failure hard to cause. Second, grant the least power that does the job. A backup account that only needs to restart one service should hold a rule for that command, not an unrestricted grant — the sudoers grammar was built for exactly that kind of narrowing.
Creating users: useradd and the account databases
Users are created with useradd, documented in the man-pages project. A careful creation sets the essentials up front: a home directory (useradd -m), a login shell (-s), and supplementary groups (-G) — group membership being how most day-to-day permissions, including sudo itself, are actually assigned. The account lands in the system's user database, /etc/passwd, which the passwd manual describes as a readable list of accounts with each user's ID, group ID, home directory and shell. Despite its name, modern systems do not keep password hashes in that file.
Hashes live in /etc/shadow, documented by the shadow manual: a root-only file holding each account's password hash plus aging fields — when the password was last changed, and the minimum and maximum days it may live. That separation is the defensive point. /etc/passwd must be readable by many programs to map IDs to names; /etc/shadow never has to be, so the hashes an attacker would love to crack offline sit behind the strictest permissions on the system. Checking who has an account, and especially who has user ID 0 — only root should — starts with reading those two files.

Passwords and account hygiene: passwd and locking
The passwd command sets or changes a user's password and enforces the aging policy recorded in shadow. Hygiene around it is unglamorous and decisive. Accounts that no longer belong to a person get locked (passwd -l or usermod -L) or removed, not left dormant with a guessable password and standing sudo rights. Service accounts that never log in interactively get a nologin shell. And root itself normally stays locked for direct login on modern distributions, so the only road to root runs through a named person's sudo — which is to say, through the log.
The bottom line
The leash is the system working as designed: daily work in an unprivileged account, elevation one command at a time through sudo, grants written narrowly in sudoers and edited only with visudo, users created deliberately with useradd, hashes sealed away in shadow, and stale accounts locked without sentimentality. None of it slows a competent administrator down in any way that matters. What it removes is the silent, permanent, unlogged root shell — the one place where a single mistake, or a single compromised session, owns the whole machine.
By Karl Amber
Sources
- The sudo project (sudo.ws) — the sudo and sudoers manuals and official documentation: sudo's permitted-user model, the sudoers policy file and drop-in directory, visudo's syntax checking and locking, and the timestamp_timeout credential cache.
- The Linux man-pages project — useradd(8) (account creation, home directory, shell and group options), passwd(1) and passwd(5) (password changes, aging, and the /etc/passwd account database), and shadow(5) (the root-only /etc/shadow file and its password-aging fields).
Editor's note: this article is part of ScanderLoud's Cybersecurity & Networking series. It was researched from the sudo project's official documentation and the Linux man-pages project — our coverage is original and educational throughout. No NetworkChuck video was opened or used.

Leave a Reply