Skip to content

#linux

One field note tagged #linux. All notes.

Debian doesn't install sudo if you set a root password

sudo: command not found on a fresh install isn’t a broken image. If you set a root password during setup, Debian assumes you’ll use su and skips the package entirely. Leave that field blank and it installs sudo and adds you to the group for you.

su -
apt update && apt install sudo -y
usermod -aG sudo your_username
exit

Log out fully and back in. Group membership is read at login, so a new shell in the same session still won’t see it. Once you’re back in, sudo whoami prints root.

This surprised me because I’d assumed sudo was a base package everywhere. It isn’t. It’s a package Debian installs conditionally, based on an answer you gave several minutes earlier and have already forgotten.