The add_user shell script creates a new user account. It is purposely limited in its abilities, and should be considered as a working example of how to add a user account to a machine. System administrators may wish to use this script as the basis for their own tools to create new accounts.
The adduser.8 manual page provides a more detailed description of the steps involved in adding a user to a machine, including those steps automated by add_user. Also refer to adduser.8 for information about user accounts involving the Network Information Service (NIS).
When run, add_user first checks that the following conditions are satisfied.
The command must be run by root.
A valid number of arguments must be suplied.
uid and gid are between 10 and 60000.
shell exists and is executable.
homedir does not already exist.
The parent directory where the home directory will be created exists.
The filesystem where the home directory will be created is a local filesystem.
uname and uid do not already exist in the /etc/passwd file.
When all of the preceding checks are satisfied, add_user performs the following steps to create a user account.
Creates an entry in the /etc/passwd file.
Creates the home directory.
Changes the ownership and group of the home directory to that of the new user.
Copies the default user startup files (.login .cshrc .rootmenu .sunview) to the user's home directory, and changes ownership and group of these files to that of the user's.
The following example shows the input required to add the user ``Lynn Long'' to the current system. Note that /usr/etc/install is not a usual path for user executables, only administrators should have this in their path.
example# /usr/etc/install/add_user lynnl 1099 10 "Lynn Long" /home/example/lynnl /bin/csh
This adds the user ``Lynn Long'' to the system, creating an entry in the /etc/passwd file that looks like:
It also creates the directory /home/example/lynnl and copies the default user startup files into it.
The numerous error messages that add_user may issue are intended to be self-explanatory.
Do not attempt to run add_user on a system that has the C2 Security software installed on it.
After successfully running add_user, either the system administrator (running as root) or the user should immediately create a password for the account, using the passwd.1 command, to deter unauthorized use of the new account.
add_user does not check to see if the gid exists in the /etc/group file on the machine. Thus the user's group may not have a name associated with it.
Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 21/April/97