Troubleshooting

usermod: command not found on Debian? Use su -, sudo or the full path

usermod: command not found on Debian means /usr/sbin is not on your PATH after plain su. Fix it with su -, sudo or /usr/sbin/usermod, also for update-grub.

Published ~7 min read
On this page

Short answer: on Debian, usermod is installed in /usr/sbin, and that folder is not on a normal user's PATH. A plain su makes you root but keeps your old PATH, so bash still answers usermod: command not found. Use su - instead of su, put sudo in front, or call it by its full path.

Debian · Ubuntu
su -                              # root login shell, PATH now has /usr/sbin
usermod -aG sudo alice

sudo usermod -aG sudo alice       # or with sudo, which uses its own PATH
/usr/sbin/usermod -aG sudo alice  # or the full path, from any root shell

The same cause is behind useradd: command not found, adduser: command not found, update-grub: command not found, reboot, shutdown and visudo on Debian: all of them sit in an sbin folder. If the message starts with sudo: instead of bash:, the program is really not installed; that case is further down.

Why Debian cannot find usermod

Debian gives root and everyone else two different PATHs. Both are set in /etc/profile, which bash and sh read when they start as a login shell. On one of our Debian 12 servers the file chooses by user ID: line 5 is for root, line 7 for everyone else.

output · Debian 12
$ grep -n PATH /etc/profile
5:  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
7:  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
9:export PATH

Since Debian 10 (buster), su comes from util-linux instead of the shadow package, and it no longer resets PATH when you call it without the dash. The Debian wiki page on what is new in buster says that after su your PATH "may not contain directories like /sbin, and many system administration commands will fail". The util-linux changelog entry for the switch (NEWS.Debian, August 2018) calls plain su "a really bad idea for many reasons" and recommends su -. So the root shell you get from su searches exactly the folders your user searched, and none of them is /usr/sbin.

These are the commands people most often hit this with. The package names and paths come from dpkg -S on our Debian 12 server and from the Debian package file lists:

CommandPath on Debian 12Debian package
usermod, useradd, groupadd/usr/sbinpasswd
adduser, deluser/usr/sbinadduser
update-grub/usr/sbingrub2-common
visudo/usr/sbinsudo
reboot, shutdown/sbin (links to systemctl)systemd-sysv
ifconfig/sbinnet-tools (not installed by default)

On Debian 12, /sbin is a symbolic link to usr/sbin, so both spellings reach the same file. For reboot and shutdown there is a short guide to rebooting and shutting down Linux.

Check what your shell can see

Four read-only commands tell you whether the file exists and whether your shell can reach it:

bash
command -v usermod          # prints the path, or nothing
type usermod                # bash: says where it is, or "not found"
ls -l /usr/sbin/usermod     # is the file there at all?
echo "$PATH" | tr ':' '\n'  # the folders this shell searches

We ran them on our Debian 12 server with the PATH a normal Debian user gets from line 7 above. The file is there and belongs to the passwd package, but bash cannot find it and exits with status 127:

output · Debian 12
$ ls -l /usr/sbin/usermod
-rwxr-xr-x 1 root root 147056 Dec 14  2025 /usr/sbin/usermod
$ dpkg -S /usr/sbin/usermod
passwd: /usr/sbin/usermod
$ env -i PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games bash -c 'usermod'; echo $?
bash: line 1: usermod: command not found
127
$ env -i PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games bash -c 'type usermod'
bash: line 1: type: usermod: not found

In an interactive shell the message reads bash: usermod: command not found (with -bash: in an SSH login shell), and dash prints sh: 1: usermod: not found. Status 127 always means the shell did not find the command; the exit code 127 guide covers the other causes.

Two traps when you test this yourself. First, env -i bash -c without any PATH is misleading: bash then falls back to its built-in default, which does include the sbin folders, so usermod is found. Second, dpkg -S wants the path the package registered. On a merged-/usr system dpkg -S /usr/sbin/reboot finds nothing, while dpkg -S /sbin/reboot names systemd-sysv:

output · Debian 12
$ env -i bash -c 'echo $PATH'
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
$ env -i HOME=/nonexistent bash -lc 'echo $PATH'
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
$ dpkg -S /usr/sbin/reboot
dpkg-query: no path found matching pattern /usr/sbin/reboot
$ dpkg -S /sbin/reboot
systemd-sysv: /sbin/reboot

The second command is a login shell started as root, so /etc/profile picked the root line with all sbin folders. That is exactly what su - gives you.

Three ways to fix it

1. Use su - instead of su

su - (the same as su -l or su --login) starts a login shell. The su man page says it clears the environment except TERM, and on Debian it takes root's PATH from ENV_SUPATH in /etc/login.defs before /etc/profile sets it again. Plain su sets only HOME and SHELL for root. The full comparison of both forms, with test output, is in our su command guide.

output · Debian 12
$ grep -E '^ENV_(SU)?PATH' /etc/login.defs
ENV_SUPATH	PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV_PATH	PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

2. Use sudo

sudo does not search your PATH for the command. Debian's default /etc/sudoers sets secure_path, and that value becomes the PATH:

output · Debian 12
$ grep secure_path /etc/sudoers
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

So sudo usermod works as long as your account may use sudo. If it may not, or sudo is not installed at all (common on Debian when the installer got a root password), log in as root once and set it up with our guide to creating a sudo user.

3. Call it by its full path

Already in a root shell from plain su? Type /usr/sbin/usermod (or /usr/sbin/update-grub, /sbin/reboot). A command name with a slash in it skips the PATH search completely.

update-grub: command not found

On Debian and Ubuntu, update-grub is a three-line wrapper. The man page calls it "a stub for running grub-mkconfig -o /boot/grub/grub.cfg", and the file on our server is exactly that:

output · Debian 12
$ cat /usr/sbin/update-grub
#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg "$@"

It lives in /usr/sbin as well, so after plain su you get the same error and the same fixes apply: sudo update-grub or su - first. Fedora, RHEL, Rocky Linux and AlmaLinux do not have update-grub at all. Their GRUB tools carry a 2 in the name, so the equivalent is:

Fedora · RHEL 9 and later · Rocky · Alma
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

On Fedora and on RHEL 9 and later that path is right for BIOS and UEFI machines alike; the file under /boot/efi/EFI/ is only a stub there. On RHEL 8 and its rebuilds, UEFI machines still keep the real file under /boot/efi/EFI/, so check the distribution's documentation before you overwrite anything.

If sudo update-grub on Debian says sudo: update-grub: command not found, the grub2-common package is missing, which usually means the system does not boot through GRUB (a container, or an image that uses another boot loader). Check how the machine boots before you install a boot loader package to make the command appear.

When usermod is really missing

When the error comes from sudo itself, PATH is no longer the explanation: sudo searched /usr/sbin and found nothing. Where that happens and what to use:

  • Debian and Ubuntu: usermod and useradd come from the passwd package, which Debian marks Priority: required, so it is almost always there. If it is not, apt install passwd as root brings it back. adduser is a separate package (Priority: important).
  • Fedora, RHEL, Rocky, Alma: the same tools are in shadow-utils; sudo dnf install shadow-utils if a minimal image lacks them.
  • Alpine Linux: the base system uses BusyBox, which has adduser, addgroup, deluser and delgroup but no useradd or usermod. Add a user to a group with addgroup alice wheel, or install the real tools with apk add shadow (community repository).
  • Docker containers: Debian based images carry passwd, so useradd works in a Dockerfile RUN line (builds run as root unless the Dockerfile sets USER). Alpine images need the BusyBox commands above, or apk add shadow.
  • macOS: there is no usermod or useradd, and zsh says zsh: command not found: usermod. Apple's porting guide manages accounts with dscl, for example sudo dscl . -append /Groups/admin GroupMembership alice, and Apple's deployment guide names sysadminctl for scripting local user accounts.

On a fresh VPS or dedicated server

A new Linux server often starts with root as its only login, and root's PATH already contains /usr/sbin. So usermod works on day one, and the error only shows up after you create a normal user, log in over SSH as that user and switch to root with plain su. From then on, make su - or sudo a habit. If you lose the root password and sudo at the same time, the provider's console is the way back in, so keep at least one working path to root before you change groups.

Once usermod runs

Most people hit this error while adding themselves to sudo, docker or www-data. Use usermod -aG, never -G alone, and log in again afterwards so the new group takes effect. Our guide to adding a user to a group explains why the -a matters, how to check membership with id, and how to undo a mistake.

What we ran: everything shown as output above was run read-only on one of our Debian 12 servers (bash 5.2.15, passwd 4.13, util-linux 2.38.1, sudo 1.9.13p3, grub2-common 2.06) on 13 November 2026. usermod itself never ran: it was only looked up. The Fedora, Alpine and macOS parts come from the Fedora and Alpine package indexes, the BusyBox command help and Apple's documentation.

Frequently asked

Why is usermod not found on Debian even as root?

You became root with plain su, which since Debian 10 keeps your own PATH, and a normal user's PATH on Debian has no /usr/sbin. usermod is installed there, so bash cannot find it. Run su - instead, which starts a login shell with root's PATH, or call /usr/sbin/usermod directly.

What is the difference between su and su - for PATH?

Plain su sets only HOME and SHELL for root and leaves PATH as it was. su - (also su -l) clears the environment and sets PATH from ENV_SUPATH in /etc/login.defs and from /etc/profile, both of which include /usr/sbin and /sbin on Debian. That is why usermod, update-grub and reboot work after su - but not after su.

How do I fix update-grub: command not found?

On Debian and Ubuntu run sudo update-grub, or su - first and then update-grub; it is a small script in /usr/sbin that runs grub-mkconfig -o /boot/grub/grub.cfg. If sudo also says command not found, the grub2-common package is missing, which usually means the system does not boot with GRUB. Fedora, RHEL, Rocky and Alma have no update-grub and use grub2-mkconfig instead.

Is there usermod on Alpine Linux or macOS?

Alpine's BusyBox base has adduser, addgroup, deluser and delgroup instead, so addgroup alice wheel adds a user to a group; apk add shadow installs the real useradd and usermod. macOS has neither command and manages accounts through Directory Services, for example sudo dscl . -append /Groups/admin GroupMembership alice.

Related articles

All troubleshooting