Linuxlab

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 alice

How it works: why not be root all the time

As root one typo is fatal and there is no record of who did what. sudo raises privileges for a single command, logs it, and drops back at once. In the sandbox sudo needs 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.