Why we don't use root for everything (and what we do instead)
Published on 2026-09-12 by frfrand
Working as root removes warnings, breaks file ownership, and erases the trace of who did what. What sudo does and how to configure it properly.

Short answer: working as root does not make you faster: it removes system protections, leaves files with the wrong owner, and erases the trace of who did what. The recommended approach is to log in with your own user, use sudo only for what needs it (even better, with per-command rules in /etc/sudoers.d), and disable root login via SSH.
"I log in as root and done, it's faster." It's a phrase heard often, and it's easy to fall into it.
The problem is that root is not an expert mode: it's a mode without brakes. The kernel does not check permissions for uid 0, so none of the protections Linux has enabled apply to you.
What follows is not a moral rule, but four quite concrete consequences.
1. No safety net
# rm -rf /var/www/ midirectorio
That extra space deletes the entire /var/www/ directory and then complains that midirectorio does not exist. As root, it executes instantly and without asking.
As a normal user, that same command fails with "Permission denied" and nothing happens. The mistake is still yours, but the system stopped it.
Many classic administration disasters are exactly this: a correct command with a wrong argument, executed by someone who could do everything.
2. Breaks file ownership
This consequence is less dramatic and much more frequent.
If you clone the repository as root, all those files end up owned by root. Then your application, which runs as www-data or as deploy, cannot write to the cache folder, or cannot create the log file, or cannot upload a file.
The symptom appears days later and bears no resemblance to the cause: an opaque 500 error, a function that "doesn't work on the server but does locally". The clue is always the same:
$ ls -l drwxr-xr-x 2 root root 4096 Nov 1 10:15 storage
That "root root" where it should say "deploy deploy" is the source of the problem.
3. The trail is lost
If three people share the root password, the system records that "root did something". It's useless.
When each person logs in with their own user and uses sudo, every privileged command is logged in /var/log/auth.log:
Nov 1 10:22:11 srv sudo: deploy : TTY=pts/0 ; PWD=/home/deploy ; USER=root ; COMMAND=/bin/systemctl restart nginx
This is not about assigning blame. It's about being able to answer "what changed here?" six weeks later without relying on anyone's memory. In most teams, that question is asked much more often than any audit.
4. And the part almost no one does: sudo is configured
sudo is not all or nothing. Permission can be granted for specific commands, which is how it should be used in most cases:
# /etc/sudoers.d/deploy deploy ALL=(ALL) NOPASSWD: /bin/systemctl restart miapp, /bin/systemctl status miapp
With that, the deploy user can restart their application without a password and without being able to do anything else. Perfect for a deployment script.
Two important warnings:
- Always edit with visudo. Validate the syntax before saving. An error in that file can leave everyone without sudo, and fixing it requires console access.
- Be careful granting permission on commands that allow executing other things. "sudo vim" is, in practice, sudo for everything: from vim you can open a shell.
The minimum worth doing
In /etc/ssh/sshd_config:
PermitRootLogin no PasswordAuthentication no
The first prevents logging in as root directly via SSH. The second forces the use of a key. With those two lines, the vast majority of automatic attempts your server will receive stop making sense.
Before reloading: sshd -t to validate, and keep a second session open just in case.
The habit worth having
When you are about to write sudo in front of something, ask yourself: does this need root, or should the service it belongs to be running as another user?
Often the correct answer is not to grant more permissions, but to fix who owns the file.
In ArduMaker, a new VPS comes with root and an admin user with sudo, each with a random password visible in the panel. By default, root can log in via SSH with a password so that whoever creates the VPS has a way in, and the SSH port is only published when you enable it (when creating the VPS it remains open for 6 hours). The two lines above can be left applied from the SSH Access app in the panel, which allows you to disable root login and password authentication and load public keys, instead of editing the file manually. And every command launched from the panel or via the MCP is logged with who executed it, which is the automatic version of the auth.log we discussed above (the interactive terminal is not included in that log).
Principle of least privilege for an application
If an API runs on an ArduMaker VPS, it should not require administrator privileges to handle requests. Create a service user, limit its write directories, and run maintenance tasks with an authorized identity.
Using sudo occasionally is different from leaving the application running permanently as root. If the code suffers a vulnerability, that distinction can limit the damage. Also review database credentials: the API user normally does not need to create or delete entire databases.
Related: Linux Users · What is privilege escalation.
Frequently asked questions
What is the difference between using sudo and logging in as root? With sudo you log in with your user and elevate permissions only for a single command, which is also recorded in /var/log/auth.log with your name. As root, everything runs without restrictions and without a signature.
How do I grant permission for a single command? With a rule in /etc/sudoers.d/ that names the exact command, always edited with visudo to validate the syntax.
Is it safe to grant permission for sudo vim? No: from vim you can open a shell, so it is equivalent to granting sudo for everything.
How do I disable root login via SSH? With PermitRootLogin no in the sshd configuration, validating with sshd -t before applying and keeping a second session open just in case. On an ArduMaker VPS it can also be done from the SSH Access app.