useradd COMMAND:
useradd - Adds new user to the linux system, with specified user-name. When a new user is added then a corresponding entry is made in files /etc/passwd, /etc/group and /etc/shadow
SYNTAX:
The Syntax is
useradd [options] [username]
OPTIONS:
-d
Specifies the users home directory
-s
Specifies the users shell
-g
Specifies the users primary group
-G
Specifies the users secondary groups
-M
Specifies not to create home directory for the user
-e
Specifies the expire date of the user
-uid
Specifies the user-id of the user
EXAMPLE:
To add new user:
useradd hiox
This command will add a new user with name hiox.
To add user but not allow to login in the system:
useradd -s /bin/nologin hiox
This command will add user hiox but not allow to login.
In above command:
hiox
-Is the user-name
/bin/nologin
-Is Shell assigned to the user
To set expire date of the user:
useradd -e 2008-06-30 hiox
This command will add user hiox and set the expire date to 2008-06-30.
In above command:
hiox
-Is the user-name
2008-06-30
-Is date on which the user-account will be expired
To create user without creating home directory:
useradd -M hiox
The above command will create user hiox but home directory will not be created.
A Note
Find LINUX Commands... Hope you enjoy this tutorial. We welcome your Valuable feedbacks or suggestions on this LINUX / UNIX cmd reference. This is a copyright content.