Adding a user
3. Before selecting a new user identification number, you must fmd one that is not being used
One method for selecting the lowest unused number is to enter the command
cut -f3 -d: /etc/passwd I sort -n
This displays the current user ID numbers in the / etc/passwd file. Pick a number that is not being used and write it in the space labeled "User identification number"
on the form in step 1. By convention, ID numbers under 100 are reserved for special uses, such as for special system functions.
Chapter 3 User and Group Administration 3-23
4. Select a group identification number.
If you are practicing, use 100; otherwise, see "The jete/group File," earlier in this chapter, for information about selecting and specifying group membership.
5. Select a home directory.
Use Idirllogin-name, where diris the directory in which you are going to put the new user accounts and login-name is the user's login name on the form. If you are
practicing, use / use r s / d umm y. You may want to use a pathname such as gmldirllogin-name
where gm represents a directory above the user's home directory. This gm directory should have the same group membership as the user's home directory, but the user should not have write permission on it. All users belonging to the same group should then have their home directories at the same level, that is, under gm. This way, the owner of the gm directory can be the group manager. Once you have decided who should be the group manager, write down the full pathname in the home directory space on the form. If you have a second disk, it may be useful to create a file system to hold user accounts.
6. Select a default shell program, such as /bin/ csh or /bin/ she
If you have no preference, choose /bin/ esh. You may also ask for the user's preference. See "Changing a User's Default Shell Program," later in this chapter, for information about using different command interpreters as a user's default shell program.
/
Specifying a user's working environment
Now that you have made your choices and have written down all the information, you can proceed with the practical steps involved in adding the user.
1. If you are not already the superuser, log in as the root user.
2. Make a copy of /etc/passwd. For instance, ep /ete/passwd /etc/passwd.old
This copy is your backup in case you accidentally destroy this critical file.
3-24 A!UX Local System Administration
030-0762-A
3. Next, use the vipw command to edit the / etc/passwd rue. You should
have all the pieces of information in front of you.
• Note: The / etc/passwd file is set as "read-only." The vipw editor copies the contents of the password file into a temporary file (/etc/ptrnp). After you edit and write the file, the editor copies the changes back to the /etc/passwd
file. The vipw editor locks the file so that it can't be modified by passwd(1)
while vipw is in use.
For more information about using vipw to edit / etc/passwd, see vipw(1M) in A/UX System Administrator's Reference.
4. Enter the following as the last line in the file, replacing each italicized word with the new user's information from the form you just completed.
login-name: password: uid: gid: mise-information: home-directory: startup-program
Be careful while you modify this file. It is essential to your users' and your own ability to gain access to the system.
Enter * in the password field for now. It will be filled by an encrypted version of the user's password in a few moments. The fifth field, mise-information, is for any miscellaneous information you care to enter (for example, the user's real name, phone number, and address). Remember to use full pathnames for the user's home directory and default shell program. If you want to play it safe, enter the following:
dummy:*:200:100:nice guy:/users/dummy:/bin/sh
5. Write the rue and quit the editor.
6. Now enter the command
pa s s wd login-name
where login-name is the name you entered in the first field of the new entry in the
passwd file. You are asked to enter the new user's password. The passwd program asks you to enter the password twice. If you do not type the same password, it asks you to try again. If the password is too short (fewer than six characters), it asks you to enter a different password (see passwd(1)). Tell it only to the new user, who should log in and set a new password as soon as possible.
Chapter 3 User and Group Administration 3-25
7. Create the user's home directory, using the patbname you entered in field six of the new entry in the passwd file, with the command
mkdi rhome-directory If you are practicing, enter mkdir/users/dummy
8. Copy the standard command files from /usr/lib/skel, for example:
cp /usr / lib/ skel/ std .login home-dir/ .login
Do the same for the .cshrc (C Shell), .profile (Bourne or Korn shell), .kshrc (Korn shell), and . logout files (C Shell). Note that the A!UX standard distribution supplies basic copies of suggested login and environment files needed for each of the A!UX shells, which are located in /usr / lib/ skel. Use your own standard files if you have them, or edit these.
9. Now you can change the ownership of the user's home directory and login or environment file or files.
Again, replace each of the italicized words with the information you entered in the passwd file. Enter the commands
chown login-name home-directory
chown login-name home-directory/login-flles
where login-flles are the files you copied from /usr / lib/ skel.
If you are practicing, change the ownership as follows:
chown dummy /users/dummy
chown dummy /users/dummy/. [a-z]*
10. Next change the group membership of the user's home directory and environment by entering the commands
chgrp group-name home-directory
chgrp group-name home-directory/ login{iles
where group-name is the name (as listed in / etc/ group) of the group ID specified in the GID field of the user's entry hi the-/etc!passwd file;
If you are practicing, enter
chgrp project /users/dummy
chgrp project /users/dummy/. [a-z]*
3-26 AlUX Local System Administration
11. Now use these commands to change the permissions associated with the