useradd(1M) UNIX System V(Essential Utilities) useradd(1M)
NAME
useradd - administer a new user login on the system
SYNOPSIS
/usr/sbin/useradd [-u uid [-o] [-g group] [-G group[,group...]] [-d dir] [-s shell]
[-c comment] [-m [-k skel_dir]] [-f inactive] [-e expire] login
/usr/sbin/useradd -D [-g group] [-b base_dir] [-f inactive] [-e expire]
DESCRIPTION
Invoking useradd without the -D option adds a new user entry to the
/etc/passwd and /etc/shadow files. It also creates supplementary group
memberships for the user (-G option) and creates the home directory (-m
option) for the user if requested. The new login remains locked until
the passwd(1M) command is executed.
Invoking useradd -D with no additional options displays the default
values for group, base_dir, shel_dir, shell, inactive, and expire. The
values for group, base_dir, inactive, expire, and shell are used for
invocations without the -D option.
Invoking useradd -D with -g, -b, -f, or -e (or any combination of these)
sets the default values for the respective fields. [As installed, the
default group is other (group ID of 1) and the default value of base_dir
is /home]. Subsequent invocations of useradd without the -D option use
these arguments.
The system file entries created with this command have a limit of 512
characters per line. Specifying long arguments to several options may
exceed this limit.
The following options are available:
-u uid The UID of the new user. This UID must be a non-negative decimal
integer below MAXUID as defined in <param.h>. The UID defaults
to the next available (unique) number above the highest number
currently assigned. For example, if UIDs 100, 105, and 200 are
assigned, the next default UID number will be 201. (UIDs from
0-99 are reserved.)
-o This option allows a UID to be duplicated (non-unique).
-g group
An existing group's integer ID or character-string name. Without
the -D option, it defines the new user's primary group membership
and defaults to the default group. You can reset this default
value by invoking useradd -D -g group.
-G group
An existing group's integer ID or character-string name. It
defines the new user's supplementary group membership.
Duplicates between group with the -g and -G options are ignored.
10/89 Page 1
useradd(1M) UNIX System V(Essential Utilities) useradd(1M)
No more than NGROUPSMAX groups may be specified.
-d dir The home directory of the new user. It defaults to
base_dir/login, where base_dir is the base directory for new
login home directories and login is the new login.
-s shell
Full pathname of the program used as the user's shell on login.
It defaults to an empty field causing the system to use /sbin/sh
as the default. The value of shell must be a valid executable
file.
-c comment
Any text string. It is generally a short description of the
login, and is currently used as the field for the user's full
name. This information is stored in the user's /etc/passwd
entry.
-m Create the new user's home directory if it doesn't already exist.
If the directory already exists, it must have read, write, and
execute permissions by group, where group is the user's primary
group.
-k skel_dir
A directory that contains skeleton information (such as .profile)
that can be copied into a new user's home directory. This
directory must exist. The system provides a ``skel'' directory
(/etc/skel) that can be used for this purpose.
-e expire
The date on which a login can no longer be used; after this date,
no user will be able to access this login. (This option is
useful for creating temporary logins.) You may type the value of
the argument expire (which is a date) in any format you like
(except a Julian date). For example, you may enter 10/6/90 or
October 8, 1990. A value of "" defeats the status of the expired
date.
-f inactive
The maximum number of days allowed between uses of a login ID
before that login ID is declared valid. Normal values are
positive integers. A value of -1 defeats the status.
login A string of printable characters that specifies the new login
name of the user. It may not contain a colon (:) or a newline
(\n).
-b base_dir
The default base directory for the system. If -d dir is not
specified. base_dir is concatenated with the user's login to
define the home directory. If the -m option is used, basedir
must exist.
Page 2 10/89
useradd(1M) UNIX System V(Essential Utilities) useradd(1M)
FILES
/etc/passwd, /etc/shadow, /etc/group, /etc/skel
SEE ALSO
groupadd(1M), groupdel(1M), groupmod(1M), logins(1M), passwd(1),
passwd(1M), userdel(1M), usermod(1M), users(1).
DIAGNOSTICS
The useradd command exits with one of the following values:
0 The command was executed successfully.
2 The command line syntax was invalid. A usage message for the
useradd command is displayed.
3 An invalid argument was provided with an option.
4 The uid specified with the -u option is already in use.
6 The group specified with the -g option does not exist.
9 The specified login is not unique.
10 Cannot update /etc/group. The login was added to the /etc/passwd
file but not to the /etc/group file.
12 Unable to create the home directory (with the -m option) or unable
to complete the copy of skel_dir to the home directory.
10/89 Page 3