Adduser command not working in Linux

When I type adduser -m username, I recieve this from the terminal:

bash: adduser: command not found (in spanish "orden no encontrada")

I tried innstalling adduser but it was already installed

2

3 Answers

Thats because its not native to all linux distros, useradd is the native command. adduser is a user-friendly version that implements Perl:

Useradd is built-in Linux command that can be found on any Linux system. However, creating new users with this low-level is a tedious task.

Adduser is not a standard Linux command. It’s essentially a Perl script that uses the useradd command in the background. This high-level utility is more efficient in properly creating new users on Linux. Default parameters for all new users can also be set through the adduser command.

Retrieved:

If you are on a Debian based distro (Ubuntu, etc) you can install it with the folowing:

sudo apt-get update
sudo apt-get install adduser

If that doesn't work, check if useradd is installed correctly.

Otherwise, if you are not on a Debian-based system (Redhat, etc) you probably just want to stick with useradd... I don't think they support adduser.

If you are on a Debian system and the installation doesn't work you might have an issue with your path variables. You can learn more about this here

4
If "useradd" is not working, check your PATH variable.
Check for presence of useradd under /usr/sbin/useradd. It should be present by default.
$ echo PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
Assign "/usr/sbin" to the path.
$ $PATH=/usr/local/bin:/usr/bin:/usr/sbin:/bin:/usr/local/games:/usr/games
$ export PATH
now "useradd" should work.
$ useradd -help|more
Usage: useradd [options] LOGIN useradd -D useradd -D [options]

Another take on this:

I was working with a container image (azul/zulu-openjdk if anyone is interested), where it looked like /usr/sbin/useradd really did not exist. adduser, however, was present and worked to create the user. Beware though, as it does have slightly different options to the useradd command.

e.g.

adduser -u <numeric uid> -G <primary group> -D <username>

-D tells adduser not to prompt for password creation after the user is created.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like