Adduser command not working in Linux
Solution 1
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
Solution 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]
Related videos on Youtube
Alexei Guchin
Updated on September 18, 2022Comments
-
Alexei Guchin over 1 year
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
-
JeremiahDuane about 4 yearsWhats flavor of linux are you running?
-
Alexei Guchin about 4 yearsI'm using Kali.
-
-
Alexei Guchin about 4 yearsI have Kali Linux, is it already installed there?? Thanks for the answer
-
JeremiahDuane about 4 yearsShould 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.
-
Alexei Guchin about 4 yearsThank you, I will try that.
-
Alexei Guchin about 4 yearsI have fixed it with the info you supplied, thank you!!