HP-UX System Administrator's Guide: Configuration Management
username is the login name for the new user.
Some of the options are described in Table 4-3. For all the options and complete
information on the command, see useradd(1M).
Table 4-3 useradd Options
MeaningOption
Default base directory for user home directory. The default is /home.-b b_dir
Full name or other comments. This is often a comma-separated string in the
form:
fullname,location,workphone,homephone
-c "comments"
Home directory path name. The default is b_dir/username.-d dir
Account expiration date. The default is none. To use the -e option, you
must enable shadow passwords. For details on how to do that, see
pwconv(1M).
-e date
Number of days the account can be inactive before being disabled. As with
the -e option, to use the -f option you must enable shadow passwords.
For details on how to do that, see pwconv(1M).
-f n
Primary working group name or group ID. Group must exist. The default
is users (group ID 20).
-g group
Comma-separated list of secondary groups. Groups must exist.
-G groups
Skeleton directory containing initialization files. The default is /etc/skel.-k skeldir
Create the home directory in addition to defining user. The default is don’t
create home directory.
-m
Shell. The default is /sbin/sh.-s shell
User ID. The default is the first available number after 100.
-u uid
The following command creates a new user account, adds patrick to the primary
working group (called users), creates a home directory, and sets up a default Korn
shell:
# useradd -g users -m -k /etc/skel -s /usr/bin/ksh patrick
The resulting entry in the /etc/passwd file is:
patrick:*:104:20::/home/patrick:/usr/bin/ksh
You can make a script with as many instances of the useraddcommand as necessary.
You can set different defaults with the useradd -D command.
After the accounts are created, set their initial passwords with the passwd command.
Manually Adding a User
Use the following steps to add a user from the command line.
Managing Users and Groups with Commands 61