adduser
Quick Reference
Command Name:
adduser
Category:
user management
Platform:
linux
Basic Usage:
Common Use Cases
Syntax
adduser [options] [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--firstuid ID] [--lastuid ID] [--gecos GECOS] [--ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] [--encrypt-home] [--add_extra_groups] [--quiet] user
Options
Option | Description |
---|---|
--home DIR | Use DIR as the user's home directory instead of the default |
--shell SHELL | Use SHELL as the user's login shell instead of the default |
--no-create-home | Do not create the user's home directory |
--uid ID | Use ID as the user ID instead of automatic selection |
--firstuid ID | Use ID as the smallest UID when automatically selecting |
--lastuid ID | Use ID as the largest UID when automatically selecting |
--gecos GECOS | Set the GECOS field (full name, etc) for the new user |
--ingroup GROUP | Add the user to GROUP instead of creating a new group |
--gid ID | Use ID as the group ID for the user's primary group |
--disabled-password | Set no password on the account |
--disabled-login | Create the account but disable login |
--encrypt-home | Encrypt the user's home directory |
--system | Create a system user (lower UID, no home directory expiry) |
--add_extra_groups | Add new user to extra groups defined in configuration |
--quiet | Suppress informational messages, only show warnings and errors |
--debug | Be verbose when processing and show debugging information |
--conf FILE | Use FILE instead of the default configuration file |
--help | Display help information and exit |
--version | Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the adduser
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
# Create a new user with default settings adduser johndoe
Advanced Examples:
# Create a user with a specific UID and GID adduser --uid 1500 --gid 1000 johndoe