Managing Systems and Workgroups: A Guide for HP-UX System Administrators

Configuring a System
Controlling Access to a System
Chapter 3250
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 useradd command
as necessary. You can set different defaults with the useradd -D
command.
Controlling File Access
Working groups, file permissions, and file ownership all determine who
can access a given file. See also “Administering a System: Managing
System Security” on page 741.
Defining Group Membership
Users on your system can be divided into working groups so that files
owned by members of a given group can be shared and yet remain
protected from access by users who are not members of the group. A
user’s primary group membership number is included as one entry in the
/etc/passwd file. Group information is defined in /etc/group and
/etc/logingroup.
Users who are members of more than one group, as specified in
/etc/group, can change their current group with the /usr/bin/newgrp
command. You do not need to use the newgrp command if user groups are
defined in /etc/logingroup. If you do not divide the users of your
system into separate working groups, it is customary to set up one group
(usually called users) and assign all users of your system to that group.
You can use SAM to add, remove, or modify group membership.
To manually change group membership, edit /etc/group and optionally
/etc/logingroup with a text editor, such as vi. Although you can enter
a group-level password in /etc/group, it is not recommended. To avoid
maintaining multiple files, you can link /etc/logingroup to
/etc/group. For details on the /etc/group and /etc/logingroup files,
see the group (4) manpage. F or information on linking files, see the link
(1M) manpage.