adduser, rmuser - add and delete users from the system
adduser [-batch username [group[,group] ...] [fullname]
[-check_only] [-class login_class] [-config_create]
[-dotdir directory] [-e method | -encryption method]
[-group login_group] [-h | -help | -?] [-home
[-message file] [-noconfig] [-shell shell]
[-s | -silent | -q | -quiet] [-uid_start uid]
[-v | -verbose] [-unencrypted]
The adduser program adds new users to the system. The
rmuser program removes
users from the system. When not passed any arguments,
operate in interactive mode and prompt for any required
The options are as follows:
-batch username [group[,group] ...] [fullname] [password]
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 properly encrypted.
Check the passwd, group, and shells databases for
problems then exit without performing any other operation.
Use the specified login_class as the default user
See login.conf(5) for further details.
Create or edit default configuration information and
before proceeding with the normal interactive adduser procedure.
Copy files from directory into the HOME directory of
Files named in the fashion of ``dot.foo'' will be
``.foo''. By default, all files are made writable
by their owner.
-encryption, -e method
Encrypt local passwords using method of encryption
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.
-help, -h, -?
Print a summary of options and exit.
Specify the default home partition where all users'
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
Do not read the default configuration file.
Specify the default shell for new users.
-silent, -s, -quiet, -q
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
mode is unencrypted. The password will be encrypted
added to the password file. Use of this option is
as the username and cleartext password will appear
in the process
list, which is visible to users.
Causes the program to print many warnings and questions. This
option is recommended for novice users.
adduser first performs consistency checks on the password,
shell databases. This includes finding any duplicate user
names, illegal shells, or shells that aren't executable.
tests are passed, adduser performs the following operations
for each new
1. Add the appropriate entries to the password and
and re-generate the password database using
2. Create a home directory and copy all files from
login directory (normally /etc/skel) to this new
Files named in the fashion of ``dot.foo'' will be
``.foo'' in the new directory.
3. Mails the new user a welcome message at the discretion of the
Similarly, when removing a user, rmuser performs the following operations
for the given username:
1. Removes any crontab(1) entries or at(1) jobs belonging to the
2. 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
adduser's unique per-user groups).
3. Recursively deletes all files in the user's home
removes the directory itself (provided the directory actually
belongs to the user). rmuser prompts for confirmation before
actually doing this.
4. Removes the user's incoming mail file if one exists.
Understandably, rmuser politely refuses to remove users
whose UID is 0
It is recommended that login names contain only lowercase characters
and digits. They may also contain uppercase
non-leading hyphens, periods, and a trailing '$'.
may not be longer than 31 characters (see BUGS section of
setlogin(2)). If you need a longer login name for
you can define an alias in
This should contain the user's first name and surname. The `:'
is not permitted.
The specified user login class must exist in
shell Only valid entries from the shells(5) database or
to sliplogin(8) and pppd(8) are permitted.
This value is the start of the range where free UID
searched for. This value must be less than the value of uid_end.
The default value is 1000 or as configured in the
This value is the end of the range where free UID
searched for. This value must be more than the value of
uid_start. The default value is 2147483647 or as
the configuration file.
This value is generated automatically, but can be
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 it.
adduser follows these steps to extract its configuration information:
1. Read internal variables.
2. Read configuration file (/etc/adduser.conf).
3. Parse command-line options.
The adduser.conf format is explained within that file and is
/etc/master.passwd user database
/etc/group group database
/etc/shells shell database
/etc/ptmp lock file for the passwd database
/etc/adduser.conf configuration file for adduser
/etc/adduser.message message file for adduser
/etc/skel skeletal login directory
/var/log/adduser log file for adduser
Start adduser in interactive mode.
# adduser -batch falken guest,staff,beer 'Prof. Falken'
Create user ``falken'' and login group ``falken''. Invite
``falken'' into groups ``guest'', ``staff'', and ``beer''.
(fullname) is ``Prof. Falken''. Password is ``joshua''
(don't use such a
password!). Send user falken a welcome message.
# adduser -uid_start 5000 -group guest -message no -batch
Create user ``vehlefanz'' in login group ``guest''. Start
the free UID
search at 5000. No other groups, no realname, no password.
Do not send
a welcome message.
chpass(1), finger(1), passwd(1), setlogin(2), aliases(5),
login.conf(5), passwd(5), shells(5), nologin(8),
OpenBSD 3.6 July 8, 1999
[ Back ]