| United States-English |
|
|
|
![]() |
HP Servers and Workstations: Managing Systems and Workgroups > Chapter 3 Configuring a SystemControlling Access to a System |
|
You can control who has access to your system, its files, and its processes. Authorized users gain access to the system by supplying a valid user name (login name) and password. Each user is defined by an entry in the file/etc/passwd. You can use SAM to add, remove, deactivate, reactivate, or modify a user account. For additional information about passwords, refer to passwd(4) and passwd(1). To manually change user account entries, use the /usr/sbin/vipw command to edit /etc/passwd; see vipw(1M) for details. See also Chapter 8 “Administering a System: Managing System Security”. You can add a user several ways: To add a user, you do the following tasks:
Consider performing the following tasks for your new user:
Using SAM to Add a UserIf you are adding a user on a remote machine, before using SAM, type the following commands on your local machine:
To see the steps that SAM executes, choose Options/View SAM Log... When you use SAM to add a user, SAM does the following:
Manually Adding a UserUse the following steps to add a user from the command line.
When you have several users to add to a system, you can save time by:
Using the SAM TemplateCreate a template that contains uniform information about accounts by initiating SAM and then choosing Users and Groups, pulling down the Actions menu, and finally choosing User Templates and Create. Read the SAM online help for details. Using the useradd CommandYou 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 “useradd Options”. See also useradd(1M). Table 3-4 useradd Options
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:
The resulting entry in the /etc/passwd file is:
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. Working groups, file permissions, and file ownership all determine who can access a given file. See also Chapter 8 “Administering a System: Managing System Security”. 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. You can assign special privileges to a group of users using the /usr/sbin/setprivgrp command. For information, refer to setprivgrp(1M), setprivgrp(2), getprivgrp(2), rtprio(2), plock(2), shmctl(2), chown(1), chown(2), getprivgrp(1), plock(2), shmctl(2),lockf(2), setuid(2), setgid(2), and setgid(2). The /usr/bin/chmod command changes the type of access (read, write, and execute privileges) for the file’s owner, group members, or all others. Only the owner of a file (or the superuser) can change its read, write, and execute privileges. For details, see chmod(1). By default, new files have read/write permission for everyone (-rw-rw-rw-) and new directories have read/write/execute permission for everyone (drwxrwxrwx). Default file permissions can be changed using the /usr/bin/umask command. For details, see umask(1). The default for trusted systems is different; see “Setting Up Your Trusted System”. The /usr/bin/chown command changes file ownership. To change the owner, you must own the file or have superuser privileges. The /usr/bin/chgrp command changes file group ownership. To change the group, you must own the file or have superuser privileges. For more information, refer to chown(1) and chgrp(1). Access control lists (ACLs) offer a finer degree of file protection than traditional file access permissions. You can use ACLs to allow or restrict file access to individual users unrelated to what group the users belong. Only the owner of a file (or the superuser) can create ACLs. ACLs are supported on both JFS and HFS file systems, but the commands and some of the semantics differ. On a JFS file system, use setacl(1) to set ACLs and use getacl(1) to view them. On an HFS file system, use chacl(1) to set ACLs and use lsacl(1) to view them. For a discussion of both JFS and HFS ACLs, see “Managing Access to Files and Directories”. For additional JFS ACL information see setacl(1), getacl(1), and aclv(5). For additional HFS ACL information, see lsacl(1), chacl(1), and acl(5).
A run-level is an HP-UX state of operation in which a specific set of processes is permitted to run. These processes and default run-levels are defined in the file /etc/inittab. The run-levels are:
The default run-level is usually run-level 3 or 4, depending on your system. The default run-level for CDE is 4. To determine the current run-level of the init process, type:
You can add to and change the sequence of processes that HP-UX starts at each run-level. See “Customizing Start-up and Shutdown”. Also see the manpage inittab(4). You can use SAM to shut down a system and change the current run-level to single-user state. Use the “Routine Tasks” and “System Shutdown” menus. The superuser logged in at the system console can also change the current run-level with the /sbin/init command, as follows:
For increased security, ensure that the permissions (and ownership) for the files /sbin/init and /etc/inittab are as follows:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||