— add and delete users from the system
adduser program adds new users to the
rmuser program removes users from the
system. When not passed any arguments, both utilities operate in interactive
mode and prompt for any required information.
The options are as follows:
- Enter batch mode in which multiple users are specified on the command line
in a compact format. By default the password is assumed to already be
- Check the passwd, group, and shells databases for consistency and problems
then exit without performing any other operation.
- Use the specified login_class as the default user
login class. See login.conf(5) for
- Create or edit default configuration information and message file before
proceeding with the normal interactive adduser procedure.
- Copy files from directory into the HOME directory of
new users. Files named in the fashion of
“dot.foo” will be renamed to
“.foo”. By default, all files are
made writable and readable by their owner.
- Encrypt local passwords using method of encryption
as described in login.conf(5). If
method is “auto”, the encryption type
will be derived from the user's login class.
- Specify the default login group. A value of USER
means that the username is to be used as the login group.
- Print a summary of options and exit.
- Specify the default home partition where all users' home directories are
to be located.
- Send new users a welcome message from file.
Specifying a value of “no” for file
causes no message to be sent to new users.
- Do not read the default configuration file.
- Specify the default shell for new users.
- Causes the program to print fewer warnings, questions, and bug
- Use UIDs from uid up when automatically generating
- Do not use UIDs higher than uid when generating
- Causes the program to assume that the password given in batch mode is
unencrypted. The password will be encrypted before being added to the
password file. Use of this option is discouraged, as the username and
cleartext password will appear in the process list, which is visible to
- Causes the program to print many warnings and questions. This option is
recommended for novice users.
adduser first performs consistency checks
on the password, group, and shell databases. This includes finding any
duplicate user or group names, illegal shells, or shells that aren't
executable. Once these tests are passed,
performs the following operations for each new user:
- Add the appropriate entries to the password and group files and
re-generate the password database using
- Create a home directory and copy all files from the skeletal login
directory (normally /etc/skel) to this new
directory. Files named in the fashion of
“dot.foo” will be renamed to
“.foo” in the new directory.
- Mails the new user a welcome message at the discretion of the account
Similarly, when removing a user,
performs the following operations for the given
- Removes any crontab(1) entries or
at(1) jobs belonging to the user.
- Removes the user from the password database and all groups in the group
database. If a group becomes empty and its name is the same as the
username, the group is removed (this complements
adduser's unique per-user groups).
- Recursively deletes all files in the user's home directory and removes the
directory itself (provided the directory actually belongs to the user).
rmuser prompts for confirmation before actually
- Removes the user's incoming mail file if one exists.
rmuser politely refuses to
remove users whose UID is 0 (typically root).
- It is recommended that login names contain only lowercase characters and
digits. They may also contain uppercase characters, non-leading hyphens,
periods, underscores, and a trailing
$’. Login names may not be longer
than 31 characters. If you need a longer login name for email addresses,
you can define an alias in /etc/mail/aliases.
- This should contain the user's first name and surname. The
:’ is not permitted.
- The specified user login class must exist in
- Only valid entries from the shells(5)
database or entries corresponding to
pppd(8) are permitted.
- This value is the start of the range where free UID values are searched
for. This value must be less than the value of uid_end. The default value
is 1000 or as configured in the configuration file.
- This value is the end of the range where free UID values are searched for.
This value must be more than the value of uid_start. The default value is
2147483647 or as configured in the configuration file.
- This value is generated automatically, but can be specified at the
discretion of the person invoking the program.
- If not empty, the password is encrypted according to
login.conf(5). If empty, the
account will be automatically disabled to prevent spurious access to
adduser follows these steps to extract its
- Read internal variables.
- Read configuration file (/etc/adduser.conf).
- Parse command-line options.
format is explained within that file and is quite straightforward. The
configuration file will be created the first time
adduser is run.
- user database
- group database
- backup of original group database
- shell database
- lock file for the passwd database
- configuration file for
- backup of original configuration file
- message file for
- backup of original message file
- skeletal login directory
- log file for
adduser in interactive mode:
Create user “falken” and login group
“falken”. Invite user “falken” into groups
“guest”, “staff”, and “beer”.
Realname (fullname) is “Prof. Falken”. The password has been
created using encrypt(1):
# adduser -batch falken guest,staff,beer 'Prof. Falken' \
Create user “vehlefanz” in login group
“guest”. Start the free UID search at 5000. No other groups,
no realname, no password. Send a welcome message:
# adduser -uid_start 5000 -group guest \
-message /etc/adduser.message -batch vehlefanz
Create user “jsmith” and place in the
“jsmith” login group. Also add to the “staff”
group. No password:
# adduser -group USER -batch jsmith