HP-UX Reference (11i v3 07/02) - 1M System Administration Commands N-Z (vol 4)
u
useradd(1M) useradd(1M)
NAME
useradd - add a new user login to the system
SYNOPSIS
useradd [-u uid [-o]] [
-g group][-G group[,group]...] [-d dir][-s
shell][-c comment]
[
-m [-i][-k
skel_dir]] [-f inactive][-e expire][-r update_homedir_ownership]
[
-p encrypted_password][
-t template][
-P -S alternate_password_file] login
useradd -D [-g group][
-b base_dir][-f inactive][-e expire][-r update_homedir_ownership]
[
-k skel_dir][-s shell][
-c comment][-O allow_dup_uids][
-t template]
DESCRIPTION
The
useradd command creates a user login on the system by adding the appropriate entry to the
/etc/passwd file and any security files, modifying the
/etc/group file as necessary, creating a home
directory, and copying the appropriate default files into the home directory depending on the command line
options. The new login remains locked until the
passwd (see passwd(1)) command is invoked.
New Behavior
The login will not be added to the primary group entry in the
/etc/group file, even if the primary group
is specified in the command line. However, the login is added to the corresponding supplemental group in
the /etc/group file.
Options
The useradd command supports the following options:
-u uid Specify the UID for the new user. uid must be a non-negative decimal integer less
than MAXUID as defined in the <param.h> header file. uid defaults to the next
available unique number above the maximum currently assigned number. UIDs from
0-99 are reserved.
-o Allow the UID to be non-unique (that is, a duplicate).
-g group Specify the integer group ID or character string name of an existing group. This
defines the primary group membership of the new login. The default for this option
can be reset by invoking the useradd -D -g group command.
-G group Specify the integer group ID or character string name of an existing group. This
defines the supplemental group memberships of the new login. Multiple groups may
be specified as a comma separated list. Duplicates within group with the -g and -G
options are ignored.
-d dir Specify the home directory of the new login. It defaults to base_dir/login, where
login is the new login and base_dir is the base directory for new login home direc-
tories.
To specify directory creation, you must use the
-m option.
-s shell Specify the full pathname of the new login shell. The default is an empty field, which
causes the system to use /sbin/sh as the login shell. The value of shell must be a
valid executable file.
-c comment Specify the comment field present in the /etc/passwd entry for this login. This
can be any text string. A short description of the new login is suggested for this field.
-m Create the home directory for the new login if it does not exist. If the home directory
exists, the directory must have read and execute permission by group, where group is
the primary group of the new login. This condition can be overridden using the -i
option. The -m option must be used to create a home directory.
-i Inherit an existing home directory, regardless of its current access permissions. Typi-
cally use this option to inherit orphaned directories, that is, directories that are not
owned by any active user of the system. Note that using the -i option will impact
shared home directories; hence use the -i option with caution. The permissions will
be same as that of a newly created home directory.
-k skel_dir Specify the skeleton directory that contains information that can be copied to the new
login’s home directory. This skeleton directory must exist. The system provides a
skeleton directory, /etc/skel , that can be used for this purpose.
HP-UX 11i Version 3: February 2007 − 1 − Hewlett-Packard Company 581