adduser - Adds a new user interactively
If you have enhanced security installed on your system, you should use
the dxaccounts command to add users. See the Security manual and the
dxaccounts(8) reference page for more information.
The adduser command is an interactive command for adding new user accounts
to your system. The command prompts you for specific information and
informs you of its activity and error conditions.
The adduser command invokes /usr/sbin/useradd to add the user account
information to /etc/passwd and the hashed password database (if present).
Only the superuser can execute this command.
The command performs the following tasks:
+ Prompts you to enter a login name for the new user. Enter the login
name. If this entry already exists in the passwd file, the command
informs you of this and exits. If the entry does not already exist,
the command creates one for the new user.
+ Prompts you to enter a UID for the new user. A default UID, which is
based on previously existing UID's in the /etc/passwd file, is
displayed and can be selected by pressing the Return key. Enter a new
UID or accept the default. The command uses this UID in the
/etc/passwd file entry for the new user.
While it is possible to have multiple entries with identical login
names and/or identical user id's, it is usually a mistake to do so.
Routines that manipulate these files will often return only one of
the multiple entries, and that one by random selection.
+ Prompts you for the full name of the new user. Enter the user's full
name. This is sometimes called the gecos entry and is displayed by the
+ Prompts you to enter a login group for the new user and specifies the
default group, users. To accept the default, press the Return key.
To select a different group, enter the name of that group, 8
characters or less. If the group does not exist, the command displays
a message saying that the group is unknown, lists the names of the
groups that are available, and asks whether or not you want to add the
new group to the /etc/group file.
If you choose the default, the command calls the addgroup command to
add the new group to the /etc/group file. The addgroup command
queries for the group number of this new group and displays a default
value based on existing group numbers in the /etc/group file. Select
the default value by pressing Return. Enter a group number or select
the default. At this point, the addgroup command ends and the adduser
There is a limitation on the number of users that can be added to a
group. The maximum line length is LINE_MAX as defined in the
<<limits.h>> file. It is recommended that the users be divided into a
number of manageable groups.
See the System Administration manual for more information on the
+ Prompts you for the name of other groups for the user to belong to.
Again, the group you specify must already exist. If you specify a
group to which the user already belongs, the command informs you of
+ Prompts you to enter the base directory for the new user and specifies
the default directory, /usr/users. To accept the default, press the
Return key. To select a different home directory, enter the path of
that directory. The path that you specify must exist within a mounted
+ Displays a message that it is adding the new user. At this point, the
command makes an entry for the user in the passwd file, creates the
home directory, creates the /var/spool/mail directory if necessary,
sets ownership and access permissions on the new user's home and mail
directories, and copies startup files such as .cshrc, .login, and
.profile for the new user to the home directory.
+ Asks if you want to edit the authentication file entry for the user.
If the environment variable EDITOR is set, adduser will use $EDITOR to
edit the user's authentication entries.
+ The adduser command automatically runs the passwd command, which asks
you to enter and verify a new password for the user. Note that you
cannot use all lowercase letters. If you do, the command asks that
you use unusual capitalization and suggests using control characters.
If you mistype the password when you are asked to verify it, no pass-
word is set and the account is disabled. To enable the user account,
enter the passwd command followed by the user name.
At this point, the command ends.
Users are advised to migrate to the /usr/sbin/useradd utility or the dxac-
counts utility as this command may be removed in a future version of the
The addgroup command limits a group name to eight characters or less. If
you specify a new group name when prompted, your entry must meet this res-
Enter a login name for the new user (for example, john): chris
Enter a UID for (chris) :
Enter a full name for (chris): Chris Ryan
Enter a login group for (chris) [users]:
Enter another group that (chris) should be a member of.
(<<Return>> for none):
Enter a parent directory for (chris) [/usr/users]:
The shells are:
/bin/sh /bin/csh /bin/ksh
Enter a login shell for (chris) [/bin/sh]:
Adding new user ...
Do you wish to edit the auth file entry for this user (y/[n])?
You must enter a new password for (chris).
Changing password for chris.
Retype new password:
Specifies the command path
Default files directory
Commands: addgroup(8), chfn(1), chsh(1), dxaccounts(8), groupadd(8),
mkpasswd(8), passwd(1), removeuser(8), useradd(8), userdel(8), vipw(8)
Files: group(4), passwd(4)