Home

useradd

Useradd is a command-line utility on Unix-like operating systems used to create a new user account. It is a low-level tool in the system’s user management toolkit and typically updates the user and group databases, such as /etc/passwd, /etc/shadow, and related files. Because it operates at a low level, it is usually used by administrators or within scripts rather than by regular users. After creating a user, a password is typically set separately to enable login.

The command accepts a range of options that configure the new account. Common options include -c for

On many distributions, a friendlier front end such as adduser provides a guided creation process while delegating

a
comment
or
full
name,
-d
to
specify
the
home
directory,
-m
to
create
the
home
directory
from
the
skeleton
directory,
-s
to
set
the
login
shell,
-g
to
define
the
primary
group,
and
-G
to
add
supplementary
groups.
It
also
supports
-u
to
assign
a
specific
user
identifier,
-r
to
create
a
system
account,
-e
to
set
an
expiration
date,
-f
to
specify
the
number
of
days
after
password
expiry
before
the
account
is
locked,
and
-p
to
provide
an
encrypted
password
(though
supplying
passwords
on
the
command
line
is
discouraged
in
favor
of
an
interactive
password
or
other
secure
methods).
Some
implementations
offer
-k
to
specify
a
skeleton
directory,
and
-M
to
avoid
creating
a
home
directory.
to
the
underlying
useradd
logic.
Administrators
should
consult
the
local
man
page,
as
options
and
defaults
vary
between
distributions
and
system
configurations.
See
also
usermod
and
userdel
for
modifying
and
removing
accounts.