Avoid logging in as root; use a dedicated user and sudo. Restrict SSH to keys and limit sudo rules. Log and audit privileged actions. In managed hosting, root may be restricted by policy.
Why not root
- Single point of compromise: If root is compromised, full system access. A dedicated user with sudo limits blast radius and makes audit clearer (who did what).
- Mistakes: Accidentally running a destructive command as root is riskier. Sudo forces an extra step and can require a password or approval.
- Audit: Sudo logs who ran what command; root activity is harder to attribute to a person.
Best practices
- Disable root SSH login (PermitRootLogin no). Use a normal user and sudo for admin tasks.
- SSH keys only; disable password authentication. Reduces brute-force and credential theft.
- Limit sudo: Grant only the commands needed (e.g. specific restarts, package updates) via sudoers. Prefer groups (e.g. wheel, admin) over individual users.
- Audit: Review auth logs and sudo logs; use centralized logging if you have many servers.
Managed hosting
- Some providers restrict root or give you a sudo user by default. Follow their model; use their support for tasks that require provider-level access.
Summary
Do not log in as root; use a dedicated user and sudo. Restrict SSH to keys; limit sudo rules; log and audit. Reduces risk and improves accountability.




