useradd(1M) useradd(1M)
NAME
useradd - administer a new user login on the system
SYNOPSIS
useradd [-u uid [-o]] [-g group] [-G group[,group ...]] [-d dir]
[-s shell] [-c comment] [-m [-k skeldir]] [-f inactive]
[-e expire] [-a event] login
useradd -D [-g group] [-b basedir] [-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(1) command is executed.
Invoking useradd -D with no additional options displays the default
values for group, basedir, sheldir, shell, inactive, and expire. The
values for group, basedir, 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 basedir 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.
OPTIONS
-a event[,...]
A comma-separated list of event types or classes that make up the
user's audit mask. There is no default user audit mask in the
system as delivered, but you can define a default user audit mask
in the file /etc/default/useradd using the defadm command. This
option is only valid if the auditing subsystem is installed.
-b basedir
The default base directory for the system. If -d dir is not
specified. basedir is concatenated with the user's login to
define the home directory. If the -m option is not used, basedir
must exist.
-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.
Page 1 Reliant UNIX 5.44 Printed 11/98
useradd(1M) useradd(1M)
-d dir
The home directory of the new user. It defaults to
basedir/login, where basedir is the base directory for new
login home directories and login is the new login.
-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 6,
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 invalid. Normal values are posi-
tive integers. A value of 0 defeats the status.
-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. No more
than NGROUPSMAX groups may be specified.
-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.
-k skeldir
A directory that contains skeleton information (such as .profile)
that can be copied into a new user's home directory. This direc-
tory must exist. The system provides a "skel" directory
(/etc/skel) that can be used for this purpose.
-m Creates 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 for group, where group is the user's pri-
mary group. If the access permissions do not match, useradd out-
puts a warning, but the command does not terminate.
-o This option allows a UID to be duplicated (non-unique).
-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.
Page 2 Reliant UNIX 5.44 Printed 11/98
useradd(1M) useradd(1M)
-u uid
The UID of the new user. This UID must be a non-negative decimal
integer which is less than MAXUID as defined in <param.h>. The
UID defaults to the first available free UID. For example, if
UIDs 100, 105, and 200 are assigned, the next default UID will be
101. (UIDs from 0-99 are reserved.)
Note:
This assignment method only works for uid < 3000. If uid uid >=
3000, you will need the SIfmllan package.
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).
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 skeldir to the home directory.
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed.
If LCMESSAGES is undefined or is defined as the null string, it
defaults to the value of LANG. If LANG is likewise undefined or null,
the system acts as if it were not internationalized.
If any of the locale variables has an invalid value, the system acts
as if none of the variables was set.
Page 3 Reliant UNIX 5.44 Printed 11/98
useradd(1M) useradd(1M)
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
FILES
/etc/passwd
/etc/shadow
/etc/group
/etc/skel
SEE ALSO
passwd(1), users(1), groupadd(1M), groupdel(1M), groupmod(1M),
logins(1M), userdel(1M), usermod(1M), group(4), passwd(4), shadow(4).
Page 4 Reliant UNIX 5.44 Printed 11/98