man-pages/man8/adduser.8.html
2021-03-31 01:06:50 +01:00

519 lines
13 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of ADDUSER</TITLE>
</HEAD><BODY>
<H1>ADDUSER</H1>
Section: Maintenance Commands (8)<BR>Updated: Version 3.118ubuntu2<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
adduser, addgroup - add a user or group to the system
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>adduser</B> [options] [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--firstuid ID] [--lastuid ID] [--ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] [--gecos GECOS] [--add_extra_groups] [--encrypt-home] user
<P>
<B>adduser</B> --system [options] [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--group | --ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] [--gecos GECOS] user
<P>
<B>addgroup</B> [options] [--gid ID] group
<P>
<B>addgroup</B> --system [options] [--gid ID] group
<P>
<B>adduser</B> [options] user group
<A NAME="lbAD">&nbsp;</A>
<H3>COMMON OPTIONS</H3>
<BR>
[--quiet] [--debug] [--force-badname] [--help|-h] [--version] [--conf FILE]
<A NAME="lbAE">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<B>adduser</B> and <B>addgroup</B>
add users and groups to the system according to command line options
and configuration information in
<I>/etc/adduser.conf</I>.
They are friendlier front ends to the low level tools like
<B>useradd,</B>
<B>groupadd</B> and <B>usermod</B>
programs, by default choosing Debian policy conformant UID and GID values,
creating a home directory with skeletal configuration, running a custom
script, and other features.
<B>adduser</B> and <B>addgroup</B>
can be run in one of five modes:
<A NAME="lbAF">&nbsp;</A>
<H3>Add a normal user</H3>
If called with one non-option argument and without the
<B>--system</B> or <B>--group</B> options, <B>adduser</B>
will add a normal user.
<P>
<B>adduser</B>
will choose the first available UID from the range specified for
normal users in the configuration file. The UID can be overridden
with the
<B>--uid</B>
option.
<P>
The range specified in the configuration file may be overridden with the
<B>--firstuid</B>
and
<B>--lastuid</B>
options.
<P>
By default, each user in Debian GNU/Linux is given a corresponding
group with the same name. Usergroups allow group writable
directories to be easily maintained by placing the appropriate users
in the new group, setting the set-group-ID bit in the directory, and ensuring
that all users use a umask of 002. If this option is turned off by setting
<B>USERGROUPS</B>
to
<I>no</I>,
all users' GIDs are set to
<B>USERS_GID</B>.
Users' primary groups can also be overridden from the command line with the
<B>--gid</B> or <B>--ingroup</B>
options to set the group by id or name, respectively. Also, users can be
added to one or more groups defined in adduser.conf either by setting
ADD_EXTRA_GROUPS to 1 in adduser.conf, or by passing
<B>--add_extra_groups </B>
on the commandline.
<P>
<B>adduser</B>
will create a home directory subject to
<B>DHOME</B>, <B>GROUPHOMES</B>, and <B>LETTERHOMES</B>.
The home directory can be overridden from the command line with the
<B>--home</B>
option, and the shell with the
<B>--shell</B>
option. The home directory's set-group-ID bit is set if
<B>USERGROUPS</B>
is
<I>yes</I>
so that any files created in the user's home directory will
have the correct group.
<P>
<B>adduser</B>
will copy files from
<B>SKEL</B>
into the home directory and prompt for finger (gecos) information and
a password. The gecos may also be set with the
<B>--gecos</B>
option. With the
<B>--disabled-login</B>
option, the account will be created but will be disabled until a
password is set. The
<B>--disabled-password</B>
option will not set a password, but login is still possible (for example
with SSH RSA keys).
To set up an encrypted home directory for the new user, add the
<B>--encrypt-home</B>
option. For more information, refer to the -b option of
<B><A HREF="/cgi-bin/man/man2html?1+ecryptfs-setup-private">ecryptfs-setup-private</A>(1).</B>
<P>
If the file
<B>/usr/local/sbin/adduser.local</B>
exists, it will be executed after the user account has been set
up in order to do any local setup. The arguments passed to
<B>adduser.local</B>
are:
<BR>
username uid gid home-directory
<BR>
The environment variable VERBOSE is set according to the following rule:
<DL COMPACT>
<DT id="1">0 if <DD>
<B>--quiet</B>
is specified
<DT id="2">1 if neither <DD>
<B>--quiet </B>
nor
<B>--debug </B>
is specified
<DT id="3">2 if <DD>
<B>--debug</B>
is specified
<P>
(The same applies to the variable DEBUG, but DEBUG is deprecated and will be removed in a later version of
<B>adduser</B>.)
<P>
</DL>
<A NAME="lbAG">&nbsp;</A>
<H3>Add a system user</H3>
If called with one non-option argument and the
<B>--system</B> option, <B>adduser</B>
will add a system user. If a user with the same name already exists in
the system uid range (or, if the uid is specified, if a user with that
uid already exists), adduser will exit with a warning. This warning can be suppressed by adding
<B>--quiet</B>.
<P>
<B>adduser</B>
will choose the first available UID from the range specified for
system users in the configuration file (FIRST_SYSTEM_UID and LAST_SYSTEM_UID). If you want to have a specific UID, you can specify it using the
<B>--uid</B>
option.
<P>
By default, system users are placed in the
<B>nogroup</B>
group. To place the new system user in an already existing group, use
the
<B>--gid</B> or <B>--ingroup</B>
options. To place the new system user in a new group with the same ID, use
the
<B>--group</B>
option.
<P>
A home directory is created by the same rules as for normal users.
The new system user will have the shell
<I>/usr/sbin/nologin</I>
(unless overridden with the
<B>--shell</B>
option), and have logins disabled. Skeletal configuration files
are not copied.
<A NAME="lbAH">&nbsp;</A>
<H3>Add a user group</H3>
If
<B>adduser</B> is called with the <B>--group</B> option and without the
<B>--system</B> option, or <B>addgroup</B> is called respectively, a user
group will be added.
<P>
<P>
A GID will be chosen from the range specified for system GIDS in the
configuration file (FIRST_GID, LAST_GID). To override that mechanism you can give the GID using the
<B>--gid</B>
option.
<P>
The group is created with no users.
<A NAME="lbAI">&nbsp;</A>
<H3>Add a system group</H3>
If
<B>addgroup</B> is called with the
<B>--system</B> option, a system group will be added.
<P>
A GID will be chosen from the range specified for system GIDS in the
configuration file (FIRST_SYSTEM_GID, LAST_SYSTEM_GID). To override that mechanism you can give the GID using the
<B>--gid</B>
option.
<P>
The group is created with no users.
<A NAME="lbAJ">&nbsp;</A>
<H3>Add an existing user to an existing group</H3>
If called with two non-option arguments,
<B>adduser</B>
will add an existing user to an existing group.
<A NAME="lbAK">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="4"><B>--conf FILE</B>
<DD>
Use FILE instead of
<I>/etc/adduser.conf</I>.
<DT id="5"><B>--disabled-login</B>
<DD>
Do not run passwd to set the password. The user won't be able to use
her account until the password is set.
<DT id="6"><B>--disabled-password</B>
<DD>
Like --disabled-login, but logins are still possible (for example using
SSH RSA keys) but not using password authentication.
<DT id="7"><B>--force-badname</B>
<DD>
By default, user and group names are checked against the configurable
regular expression
<B>NAME_REGEX</B>
(or
<B>NAME_REGEX_SYSTEM</B>
if
<B>--system</B>
is specified)
specified in the configuration file. This option forces
<B>adduser</B>
and
<B>addgroup</B>
to apply only a weak check for validity of the name.
<B>NAME_REGEX</B>
is described in
<B><A HREF="/cgi-bin/man/man2html?5+adduser.conf">adduser.conf</A></B>(5).
<DT id="8"><B>--gecos GECOS</B>
<DD>
Set the gecos field for the new entry generated.
<B>adduser </B>
will not ask for finger information if this option is given.
<DT id="9"><B>--gid ID</B>
<DD>
When creating a group, this option forces the new groupid to be the
given number. When creating a user, this option will put the user in
that group.
<DT id="10"><B>--group</B>
<DD>
When combined with
<B>--system</B>,
a group with the same name and ID as the system user is created.
If not combined with
<B>--system</B>,
a group with the given name is created. This is the default action if
the program is invoked as
<B>addgroup</B>.
<DT id="11"><B>--help</B>
<DD>
Display brief instructions.
<DT id="12"><B>--home DIR</B>
<DD>
Use DIR as the user's home directory, rather than the default specified by the
configuration file. If the directory does not exist, it is created
and skeleton files are copied.
<DT id="13"><B>--shell SHELL</B>
<DD>
Use SHELL as the user's login shell, rather than the default specified by the
configuration file.
<DT id="14"><B>--ingroup GROUP</B>
<DD>
Add the new user to GROUP instead of a usergroup or the default group
defined by
<B>USERS_GID </B>
in the configuration file. This affects the users primary group. To add additional
groups, see the
<B>add_extra_groups</B>
option.
<DT id="15"><B>--no-create-home</B>
<DD>
Do not create the home directory, even if it doesn't exist.
<DT id="16"><B>--quiet</B>
<DD>
Suppress informational messages, only show warnings and errors.
<DT id="17"><B>--debug</B>
<DD>
Be verbose, most useful if you want to nail down a problem with adduser.
<DT id="18"><B>--system</B>
<DD>
Create a system user or group.
<DT id="19"><B>--uid ID</B>
<DD>
Force the new userid to be the given number.
<B>adduser </B>
will fail if the userid is already taken.
<DT id="20"><B>--firstuid ID</B>
<DD>
Override the first uid in the range that the uid is chosen from (overrides
<B>FIRST_UID</B>
specified in the configuration file).
<DT id="21"><B>--lastuid ID</B>
<DD>
Override the last uid in the range that the uid is chosen from (
<B>LAST_UID</B>
)
<DT id="22"><B>--add_extra_groups</B>
<DD>
Add new user to extra groups defined in the configuration file.
<DT id="23"><B>--version</B>
<DD>
Display version and copyright information.
<P>
</DL>
<A NAME="lbAL">&nbsp;</A>
<H2>EXIT VALUES</H2>
<P>
<DL COMPACT>
<DT id="24"><B>0 </B>
<DD>
The user exists as specified. This can have 2 causes: The user was created by adduser or the user was already present on the system before adduser was invoked. If adduser was returning 0 , invoking adduser a second time with the same parameters as before also returns 0.
<DT id="25"><B>1</B>
<DD>
Creating the user or group failed because it was already present with other UID/GID than specified. The username or groupname was rejected because of a mismatch with the configured regular expressions, see <A HREF="/cgi-bin/man/man2html?5+adduser.conf">adduser.conf</A>(5). Adduser has been aborted by a signal.
<BR>
Or for many other yet undocumented reasons which are printed to console then. You may then consider to remove
<B>--quiet</B>
to make adduser more verbose.
<P>
</DL>
<A NAME="lbAM">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<DT id="26">/etc/adduser.conf<DD>
Default configuration file for adduser and addgroup
<DT id="27">/usr/local/sbin/adduser.local<DD>
Optional custom add-ons.
<P>
</DL>
<A NAME="lbAN">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?5+adduser.conf">adduser.conf</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?8+deluser">deluser</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+groupadd">groupadd</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+useradd">useradd</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+usermod">usermod</A></B>(8),
Debian Policy 9.2.2.
<P>
<A NAME="lbAO">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright (C) 1997, 1998, 1999 Guy Maor. Modifications by Roland
Bauerschmidt and Marc Haber. Additional patches by Joerg Hoh and Stephen Gran.
<BR>
Copyright (C) 1995 Ted Hajek, with a great deal borrowed from the original
Debian
<B>adduser</B>
<BR>
Copyright (C) 1994 Ian Murdock.
<B>adduser</B>
is free software; see the GNU General Public Licence version 2 or
later for copying conditions. There is
<I>no</I>
warranty.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="28"><A HREF="#lbAB">NAME</A><DD>
<DT id="29"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DL>
<DT id="30"><A HREF="#lbAD">COMMON OPTIONS</A><DD>
</DL>
<DT id="31"><A HREF="#lbAE">DESCRIPTION</A><DD>
<DL>
<DT id="32"><A HREF="#lbAF">Add a normal user</A><DD>
<DT id="33"><A HREF="#lbAG">Add a system user</A><DD>
<DT id="34"><A HREF="#lbAH">Add a user group</A><DD>
<DT id="35"><A HREF="#lbAI">Add a system group</A><DD>
<DT id="36"><A HREF="#lbAJ">Add an existing user to an existing group</A><DD>
</DL>
<DT id="37"><A HREF="#lbAK">OPTIONS</A><DD>
<DT id="38"><A HREF="#lbAL">EXIT VALUES</A><DD>
<DT id="39"><A HREF="#lbAM">FILES</A><DD>
<DT id="40"><A HREF="#lbAN">SEE ALSO</A><DD>
<DT id="41"><A HREF="#lbAO">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:10 GMT, March 31, 2021
</BODY>
</HTML>