How to unix and linux add user using useradd

Use of linux add user

In Linux/Unix user is one who use the system. There can be at least one or more
than one users in Linux/Unix at a time. Users on a system are identified by a
username and a userid. The username is typically a user friendly string, such
as your name, whereas the user id is a number. The user id numbers should be
unique (one number per user).

About  useradd
Useradd used
for create a new user or sets the defaults information for new user.


In some other Linux flavor, may come with a slightly different version of linux add user command. I suggest you to read
your documentation, before using useradd command  to create new user accounts in Linux.
In Linux add user command is a low-level utility that is used for adding or creating user accounts in Linux and Unix operating systems.
The useradd command creates new user account using values which specified on the command line and the default values from the system. Depending on command attributes, the useradd command will update system files and may also create the new user’s home directory and copy initial files. The ‘adduser‘ is similar to useradd
command, because it is just a symbolic link to it.
When you add new user using useradd command by default a group will also created for a
new user.

Syntax for Linux add User

useradd  [username]
useradd  -D
useradd  [options]
useradd  -D
linux add user



-c [comment]
Comment can be any text string
like Full name of the user (brief information about user).
-u [user id]
The unique numerical value use for
the user ID, unless the –o option is used. The value must be positive value. Values
less than 500 are reserved for system users.
-g [group]
The default group or group id
create for the new user. Using this option we specify group id for group.
-d [home directory]
Create Home directory for the
user. The default value is /home/[username]/.
-s [shell]
Specify the user login shell for
the user. The default shell is /bin/bash.
Do not create a home directory for
the user. This option use when directory already exists or by default a home
directory is created.
useradd with attributes

Leave a Reply

Your email address will not be published. Required fields are marked *