Useradd Command

What is the Useradd Command?

The useradd command is used to create a new user on a Linux system. It allows system administrators to add users, set their home directories, and configure their login settings.

How Does It Work?

When you run useradd, the system creates a new user with the specified parameters, including assigning a username, password, and default home directory.

Syntax: useradd [options] username

Common Options

Here are some commonly used options with the useradd command:

Examples of Using the Useradd Command

Here are some practical examples of how to use the useradd command:

To create a new user "john" with a home directory: $ useradd -m john
To create a user "alice" and assign her to the "dev" group: $ useradd -m -g dev alice
To create a user "bob" with a specific shell: $ useradd -m -s /bin/bash bob

Visual Example

Learn more about user management User management is crucial for setting up permissions and access control in a Linux system. below:

Useradd Command Example