root is Linux's traditional all-powerful administrator account, normally UID 0. Ordinary users are constrained by permissions and policy; root can access and modify almost the entire system. id is a reliable identity check. A # or $ prompt is only a hint because prompts are customizable.
sudo elevates one command
sudo runs a command as an authorized identity, most often root. sudo apt update may ask for the current user's password, but later commands do not permanently become root. sudo -l lists allowed operations; distributions commonly grant access through sudo or wheel groups.
One administrative commandsudo command
Clear privilege boundary and easier review.
Several administrative taskssudo -i … exit
Every command in the root shell needs extra care.
Why not stay root?
Permission barriers are protection. rm /etc/hosts normally fails as an ordinary user but may really delete the file under root or sudo. Check targets and arguments before privileged rm, mv, chmod, or chown commands.
sudo is not a universal Permission denied fix
A permission error may reveal a wrong path, wrong owner, or a program that belongs in user space. Editing root-owned project files with sudo only hides the cause; investigate and restore ownership. Prefer sudo command for one administrative task. If you use sudo -i, return with exit when finished.
Take one second: Before pressing Enter after sudo, reread the command, target machine, and target path.
Least-Privilege Checkpoint
mkdir ~/projectKNOWLEDGE QUIZ
KNOWLEDGE QUIZ
A Safe Privilege Investigation
You cannot edit config.yaml in a project. Investigate first; do not grant mode 777.
- Confirm your identity and groups.
- Inspect the file's owner, group, and mode.
- List the current user's sudo authorization.
- Assuming root ownership is accidental, restore alice:developers and verify; explain why editing no longer needs sudo.