Create User Account in UNIX / Linux

0
598

System administrator had access to create user accounts to allow users to login. They can create user account with default configuration or by custom configuration.

To Create User Account in UNIX / Linux

useradd command is used to add user account in Linux or Unix systems. Also there is an alternative command to add user is adduser command which is friendlier and very similar to ‘useradd’ command.

Syntax:

Here USERNAME refers to the login name of the user. Please note that the USERNAME should be unique and not already exists.

Example:

In the above example, a new user “etechtricks” account is created with default configurations. By using usermod command, user account values can be modified later.

To set password for the user

Once the user account is created, password should be assigned to the new user using passwd command otherwise the account remains locked.

Syntax:

Once the above command is executed, you will get the prompt option to create password for the respected username.

Most commonly used options:

 -d HOMEDIR  By default user’s directory will be created under /home directory. -d option is used to change the home directory of the user.
 -g GROUP  To add the new user to the existing group.
 -h  This options shows help message and exit the operation.
 -r  To create a system account.

LEAVE A REPLY