sudo: become root for one command
Updated July 3, 2026
sudo runs one command as root and then returns you to your normal user. So you need not sit as root all the time.
sudo useradd -m alice # one command as root
sudo -l # what am I allowed
sudo -u alice whoami # run as aliceHow it works: why not be root all the time
As root one typo is fatal and there is no record of who did what.
sudoraises privileges for a single command, logs it, and drops back at once. In the sandboxsudoneeds no password, and root is capped anyway: some kernel operations are off, so mistakes are safe.
Used in
You need this in the lesson Users and permissions.