Managing Systems and Workgroups: A Guide for HP-UX System Administrators
Configuring a System
Controlling Access to a System
Chapter 3 249
Using the useradd
Command
You can use the useradd command to add users, as well as usermod and
userdel for modifying and deleting them. useradd has the form:
/usr/sbin/useradd [
option
] ...
username
username
is the new login name for the user. The options are described
in Table 3-6. See also useradd (1M).
Table 3-4 useradd Options
Option Meaning
-u
uid
UID (defaults to next highest number).
-g
group
Primary working group name or group ID. Group
must exist. The default is 20.
-G
groups
Comma-separated list of secondary groups.
Groups must exist.
-b
b_dir
Default base directory for user home directory.
The default is /home.
-d
dir
Home directory path name. The default is
b_dir/username
.
-m Create home directory /home in addition to
defining user.
-s
shell
Shell. The default is an empty field, which
defaults to /sbin/sh.
-c "
comments
" Full name or other comments. This is often a
comma-separated string in the form:
fullname
,
location
,
workphone
,
homephone
-k
dir
Skeleton directory containing initialization files.
The default is /etc/skel.
-e
date
Account expiration date. The default is none.
Requires enhanced security.
-f
n
Number of days the account can be inactive before
being disabled. Requires enhanced security.