Quiz Entry - updated: 2026.10.13
Why does adduser bob fail for a normal user, and what do su and sudo do?
Creating a user writes to root-only files such as /etc/passwd and /etc/shadow, so it needs root; sudo runs one command as root, su switches to another user.
adduser has to append to /etc/passwd, /etc/shadow and /etc/group and create a home directory under /home. Only root can write there, so a normal user gets a "only root may add a user" error (or permission denied).
| Command | What it does | Whose password |
|---|---|---|
sudo <cmd> |
Runs one command as root (or another user), if /etc/sudoers allows it |
Your own |
su <user> |
Switch user: starts a shell as that user | The target user's |
su - <user> |
Same, but a full login shell with that user's environment and home | The target user's |
sudo is the better admin tool: rights can be limited per command, every call is logged, and the root password does not have to be shared. su bob is handy to test what bob is allowed to do.
Go deeper:
Wikipedia: sudo — how sudo checks its rules and logs each call.
Wikipedia: su (Unix) — su vs su -, and why sudo largely replaced it.
Debian manpage: adduser(8) — what adduser creates: user, private group, home.