ADDUSER(8) | System Manager's Manual | ADDUSER(8) |
adduser, addgroup - add or manipulate users or groups
adduser |
[--add-extra-groups] [--allow-all-names] [--allow-bad-names] [--comment comment] [--conf file] [--debug] [--disabled-login] [--disabled-password] [--firstgid id] [--firstuid id] [--gid id] [--home dir] [--ingroup group] [--lastgid id] [--lastuid id] [--no-create-home] [--shell shell] [--quiet] [--uid id] [--verbose] user |
adduser |
--system [--comment comment] [--conf file] [--debug] [--gid id] [--group] [--home dir] [--ingroup group] [--no-create-home] [--shell shell] [--uid id] [--quiet] [--verbose] user |
adduser |
--group [--conf file] [--debug] [--firstgid id] [--gid ID] [--lastgid id] [--quiet] [--verbose] group |
addgroup |
[--conf file] [--debug] [--firstgid id] [--gid ID] [--lastgid id] [--quiet] [--verbose] group |
addgroup |
--system [--gid id] [--conf file] [--quiet] [--verbose] group |
adduser |
[--conf file] [--debug] [--quiet] [--verbose] user group |
adduser |
--help |
adduser |
--version |
adduser and addgroup add users and groups to the system according to command line options and configuration information in /etc/adduser.conf. They are friendlier front ends to the low level tools like useradd, groupadd and usermod 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.
adduser and addgroup are intended as a policy layer, making it easier for package maintainers and local administrators to create local system accounts in the way Debian expects them to be created, taking the burden to adapt to the probably changing specifications of Debian policy. adduser --system takes special attention on just needing a single call in the package maintainer scripts without any conditional wrappers, error suppression or other scaffolding.
adduser honors the distinction between dynamically allocated system users and groups and dynamically allocated user accounts that is documented in Debian Policy, Chapter 9.2.2.
For a full list and explanations of all options, see the OPTIONS section.
adduser and addgroup can be run in one of five modes:
If called with one non-option argument and without the --system or --group options, adduser will add a normal user, that means a dynamically allocated user account in the sense of Debian Policy. This is commonly referred to in adduser as a non-system user.
adduser will choose the first available UID from the range specified by FIRST_UID and LAST_UID in the configuration file. The range may be overridden with the --firstuid and --lastuid options. Finally, the UID can be set fully manually with the --uid option.
By default, each user is given a corresponding group with the same name. This is commonly called Usergroups and allows 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.
For a usergroup, adduser will choose the first available GID from the range specified by FIRST_GID and LAST_GID in the configuration file. The range may be overridden with the --firstgid and --lastgid options. Finally, the GID can be set fully manually with the --gid option.
The interaction between USERS_GID, USERS_GROUP, and USERGROUPS is explained in detail in adduser.conf(5).
Users' primary groups can also be overridden from the command line with the --gid or --ingroup options to set the group by id or name, respectively. Also, users can be added to one or more supplemental groups defined as EXTRA_GROUPS in the configuration file either by setting ADD_EXTRA_GROUPS to 1 in the configuration file, or by passing --add-extra-groups on the command line.
adduser will copy files from /etc/skel into the home directory and prompt for the comment field and a password if those functions have not been turned off / overridden from the command line.
UID, comment, home directory and shell might be pre-determined with the UID_POOL and GID_POOL option, documented in adduser.conf(5).
If called with one non-option argument and the --system option, adduser will add a dynamically allocated system user, often abbreviated as system user in the context of the adduser package.
adduser will choose the first available UID from the range specified by FIRST_SYSTEM_UID and LAST_SYSTEM_UID in the configuration file. This can be overridden with the --uid option.
By default, system users are placed in the nogroup group. To place the new system user in an already existing group, use the --gid or --ingroup options. If the --group is given and the identically named group does not already exist, it is created with the same ID.
If no home directory is specified, the default home directory for a new system user is /nonexistent. This directory should never exist on any Debian system, and adduser will never create it automatically.
Unless a shell is explicitly set with the --shell option, the new system user will have the shell set to /usr/sbin/nologin. adduser --system does not set a password for the new account. Skeletal configuration files are not copied.
Other options will behave as for the creation of a normal user. The files referenced by UID_POOL and GID_POOL do also work.
If adduser is called with the --group option and without the --system option, or addgroup is called respectively, a user group will be added.
A dynamically allocated system group, often abbreviated as system group in the context of the adduser package, will be created if adduser is called with the --system option.
A GID will be chosen from the respective range specified for GIDs in the configuration file (FIRST_GID, LAST_GID, FIRST_SYSTEM_GID, LAST_SYSTEM_GID). To override that mechanism, you can give the GID using the --gid option.
For non-system groups, the range specified in the configuration file may be overridden with the --firstgid and --lastgid options.
The group is created with no members.
If called with two non-option arguments, adduser will add an existing user to an existing group.
Different modes of adduser allow different options. If no valid modes are listed for a option, it is accepted in all modes.
Short versions for certain options may exist for historical reasons. They are going to stay supported, but are removed from the documentation. Users are advised to migrate to the long version of options.
Or for many other yet undocumented reasons which are printed to console then. You may then consider to remove --quiet to make adduser more verbose.
adduser needs root privileges and offers, via the --conf command line option to use different configuration files. Do not use sudo(8) or similar tools to give partial privileges to adduser with restricted command line parameters. This is easy to circumvent and might allow users to create arbitrary accounts. If you want this, consider writing your own wrapper script and giving privileges to execute that script.
Unfortunately, the term system account suffers from double use in Debian. It both means an account for the actual Debian system, distinguishing itself from an application account which might exist in the user database of some application running on Debian. A system account in this definition has the potential to log in to the actual system, has a UID, can be member in system groups, can own files and processes. Debian Policy, au contraire, in its Chapter 9.2.2, makes a distinguishment of dynamically allocated system users and groups and dynamically allocated user accounts, meaning in both cases special instances of system accounts. Care must be taken to not confuse this terminology. Since adduser and deluser(8) never address application accounts and everything in this package concerns system accounts here, the usage of the terms user account and system account is actually not ambiguous in the context of this package. For clarity, this document uses the definition local system account or group if the distinction to application accounts or accounts managed in a directory service is needed.
adduser used to have the vision to be the universal front end to the various directory services for creation and deletion of regular and system accounts in Debian since the 1990ies. This vision has been abandoned as of 2022. The rationale behind this includes: that in practice, a small server system is not going to have write access to an enterprise-wide directory service anyway, that locally installed packages are hard to manage with centrally controlled system accounts, that enterprise directory services have their own management processes anyway and that the personpower of the adduser team is unlikely to be ever strong enough to write and maintain support for the plethora of directory services that need support.
adduser will constrict itself to being a policy layer for the management of local system accounts, using the tools from the password package for the actual work.
Inconsistent use of terminology around the term system account in docs and code is a bug. Please report this and allow us to improve our docs.
adduser takes special attention to be directly usable in Debian maintainer scripts without conditional wrappers, error suppression and other scaffolding. The only thing that the package maintainer should need to code is a check for the presence of the executable in the postrm script. The adduser maintainers consider the need for additional scaffolding a bug and encourage their fellow Debian package maintainers to file bugs against the adduser package in this case.
adduser.conf(5), deluser(8), groupadd(8), useradd(8), usermod(8), Debian Policy 9.2.2.
Debian GNU/Linux |