← 返回命令列表

Linux command

adduser 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

adduser [username]

Example

adduser --no-create-home [username]

Example

adduser --home [path/to/home] [username]

Example

adduser --shell [path/to/shell] [username]

Example

adduser --ingroup [group] [username]

Example

adduser [username] [group]

说明

adduser adds users and groups to the system according to command line options and configuration in /etc/adduser.conf. It is a Debian-specific front end to the useradd, groupadd, and usermod programs with policy-compliant defaults. The utility chooses appropriate UID/GID values, creates home directories with skeletal configuration files, and supports both regular and system accounts.

参数

--home dir
Specify home directory
--no-create-home
Skip home directory creation
--shell shell
Set login shell
--uid ID
Specify user ID
--gid GID
Set primary group ID
--ingroup GROUP
Set primary group by name
--system
Create system account
--group
Create group (or named group for system user)
--disabled-login
Disable login (no password set, login not possible until enabled)
--disabled-password
Do not set a password (login via other methods like SSH keys still possible)
--gecos GECOS
Set GECOS field (full name, room, phone, etc.) without interactive prompt
--add-extra-groups
Add user to EXTRA_GROUPS defined in config
--firstuid ID
Override the first UID in the range for new users
--lastuid ID
Override the last UID in the range for new users
--quiet
Suppress informational messages, only show warnings and errors
--debug
Be verbose, useful for troubleshooting
--conf file
Use alternate configuration file instead of /etc/adduser.conf

FAQ

What is the adduser command used for?

adduser adds users and groups to the system according to command line options and configuration in /etc/adduser.conf. It is a Debian-specific front end to the useradd, groupadd, and usermod programs with policy-compliant defaults. The utility chooses appropriate UID/GID values, creates home directories with skeletal configuration files, and supports both regular and system accounts.

How do I run a basic adduser example?

Run `adduser [username]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --home dir do in adduser?

Specify home directory