0

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

bash: adduser: command not found

(in spanish orden no encontrada)

I tried installing adduser but it was already installed.

2
  • Whats flavor of linux are you running? Apr 20, 2020 at 3:39
  • I'm using Kali. Apr 20, 2020 at 14:13

3 Answers 3

2

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: https://linuxhandbook.com/useradd-vs-adduser/

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 https://youtu.be/Jp0WWDSJ3Ac

4
  • I have Kali Linux, is it already installed there?? Thanks for the answer Apr 20, 2020 at 14:12
  • Should be... Im guessing there is an issue with you path variables ... I'm adding a link to my original answer on how to fix the paths. Apr 20, 2020 at 15:09
  • Thank you, I will try that. Apr 20, 2020 at 15:49
  • I have fixed it with the info you supplied, thank you!! Apr 20, 2020 at 16:04
2

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]
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .