# useradd dev1
bash: useradd: command not found
# which useradd
which: no useradd in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
The most common reason for not being able to execute the useradd command on Linux is that you do not have the required packages installed.
Fix: useradd command not found
Install the shadow-utils using the yum package manager,
# yum install shadow-utils
...
Dependencies Resolved
======================================
Package Arch Version Repository Size
======================================
Installing:
shadow-utils aarch64 2:4.1.5.1-24.amzn2.0.2 amzn2-core 1.1 M
Installing for dependencies:
audit-libs aarch64 2.8.1-3.amzn2.1 amzn2-core 99 k
libcap-ng aarch64 0.7.5-4.amzn2.0.4 amzn2-core 25 k
libsemanage aarch64 2.5-11.amzn2 amzn2-core 150 k
ustr aarch64 1.0.4-16.amzn2.0.3 amzn2-core 90 k
Transaction Summary
======================================
Install 1 Package (+4 Dependent packages)
Total download size: 1.4 M
Installed size: 4.8 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): audit-libs-2.8.1-3.amzn2.1.aarch64.rpm | 99 kB 00:00:00
(2/5): libsemanage-2.5-11.amzn2.aarch64.rpm | 150 kB 00:00:00
(3/5): libcap-ng-0.7.5-4.amzn2.0.4.aarch64.rpm | 25 kB 00:00:01
(4/5): ustr-1.0.4-16.amzn2.0.3.aarch64.rpm | 90 kB 00:00:01
(5/5): shadow-utils-4.1.5.1-24.amzn2.0.2.aarch64.rpm | 1.1 MB 00:00:03
------------------------------------------------------------------------------------------------------------------------------------------
Total 223 kB/s | 1.4 MB 00:00:06
Running transaction check
..
Installed:
shadow-utils.aarch64 2:4.1.5.1-24.amzn2.0.2
Dependency Installed:
audit-libs.aarch64 0:2.8.1-3.amzn2.1 libcap-ng.aarch64 0:0.7.5-4.amzn2.0.4 libsemanage.aarch64 0:2.5-11.amzn2
ustr.aarch64 0:1.0.4-16.amzn2.0.3
Complete!
# useradd dev1
# cat /etc/passwd | grep dev
dev1:x:1000:1000::/home/dev1:/bin/bash

Tested on Amazon Linux Docker Image
-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to Linux,
- Rename a directory using Linux/Unix command
- ls command to list only directories
- How to Restart or Reload Nginx Server Service on Linux
- 3 ways to clear screen on Linux Terminal
- ls command: sort files by name alphabetically A-Z or Z-A [Linux/Unix/macOS/Bash]
- Copy entire directory using Terminal Command [Linux, Mac, Bash]
- Fix: sudo: unable to open Read-only file system
- Create Hidden File or Directory using Shell Command
- Command to know the installed Debian version?
- The Date Command and its usage [Linux - Unix - macOS]
- Fix - bash: man: command not found
- How to tar.gz a directory or folder Command
- How to Display content of a file in Terminal Screen?
- How to change bash terminal prompt string and color
- Sort ls command by last modified date and time
- Execute .bin and .run file Ubuntu Linux
- zsh hello world example
- How to check uptime of Linux/Unix/macOS system/server using console command?
- [Fix] Linux - bash: useradd: command not found
- Command to check Last Login or Reboot History of Users and TTYs
- How to install and Configure sar sysstat tools in Ubuntu Linux
- How to use SCP Command to Copy Directory
- Linux Remove or Delete Files and Directories using Terminal Commands
- How to connect to SSH port other than default 22
- Install OpenSSL on Linux/Ubuntu
More Posts:
- How to show line numbers in Nano on Mac - MacOS
- [fix] docker: Error response from daemon: dial unix docker.raw.sock: connect: no such file or directory. - Docker
- Program 11: Calculate Percentage - 1000+ Python Programs - Python-Programs
- How to delete AWS SNS Subscription using CLI - AWS
- Split a String in Java with Examples - Java
- 70+ HTTP Error Codes CheatSheet - Html
- Elegant CSS Box Shadows Ideas - CSS
- Manually Throw an Exception in Python (raise:) - Python