Create User without using Useradd Command on Linux

The UserAdd Command is most popular command for addition of normal user for Linux distributions the trick is featured here for How to Create User Without Using UserAdd Command on Linux by following the steps carefully.

Introduction to the Linux Users

There are three types of users present in the Linux OS. So first let’s talk about the users.

  1. SUPER USER: Superuser has an administrative permission in Linux we called it as root user and Its user ID is 0.
  2. SYSTEM USER: System users are system created users and so that we can’t have permission to login through these users.
  3. NORMAL USERS: With these users, we can login into the system. While the installation it asks you to add one normal user of the system,so you can login into the system with this normal user or with the root user.

How to Add User Using a UserAdd Command?

Step-I(Add user using UserAdd Command)
[[email protected]] # useradd techbrown
[[email protected]] # passwd gopal
Changing password for user gopal.
New password: *****
BAD PASSWORD: it is too short
BAD PASSWORD: is too simple
Retype new password: *****
passwd: all authentication tokens updated successfully.
Step-II(Normal User Login)
[[email protected] ~]# su – gopal
[[email protected] ~]$

Steps to Create User Without Using UserAdd Command

So let’s talk about what is exactly happening when we use the UserAdd Command.

Here I am explaining it using some steps, but you can use these steps in any order.

So now let’s create it manually

STEP-I(The system creates a directory with the name of ‘user’ in “/home” directory)

Now we create a user with a username techbrown. So start with the first step

[[email protected]] # mkdir /home/techbrown

It will create a home directory for user techbrown

STEP-II(Creates an entry in /etc/passwd file)
[[email protected]] # touch /var/spool/mail/techbrown

This command will create a file in the mail directory so that all mail’s come to the user techbrown directly stores in this file.

STEP-III(Creates an entry in /etc/shadow file)

Now we create an entry in passwd file so that the getty script will discover a information about the user.

[[email protected]] # vim /etc/passwd

Now it will show some users information which that are previously created.

So now just make an entry in it as following or simple way just copy one of the entry from it. By using “yy(yank or copy)” and “p(paste)” and then edit it.

techbrown:x:501:501:Hello techbrown :/home/gopal:/bin/bash
1 :2 :3 :4 :5: 6 : 7


Here in “/etc/passwd“file you have to create 7 entries. Let’s discuss about it shortly.


It indicates that the password is encrypted and stores in a shadow file

User ID
Group ID
Home directory of the User

Last one shell prompt you can check it through “/etc/shells” file.

STEP-IV(Creates an entry in /etc/groups file)

Now we are going to make entry in the shadow file which stores the information about an user with the encrypted password.

[[email protected]] # vim /etc/shadow

Now make entry in this file.

techbrown:! !:16244:0:99999:7: : :
1 :2 :3 :4:5 :6:7:8:9


You will see 9 entries presently available in the /etc/shadow file so we will also discuss about that.

Name of a user
Password in encrypted
The number of days since 1 January 1970 that the password last changed.
The number of days permitted before the password can be changed.
The number of days after which the password must be changed.
The number of days before the password expires that the user is warned.
The number of days after the password expires before the account is disabled.
The number of days since 1 January 1970 after which the account is disabled.
Reserved for the feature.
but in above we didn’t edit that so just do the following step

first go to the shell prompt and type following command

[[email protected]] # grub-md5-crypt
password:[type your password]
retype password : [type above password again]

Now copy and paste this password in this section.

STEP-V(Create a file for mail address so that the mail come to that user will be shown in that file which is present in “/var/spool/mail/’username’”)

Now create a entry in the /etc/groups directory.

[[email protected]] # vim /etc/groups
techbrown :x : 501:
1 :2 : 3 :4


Here 1:2:3:4 as

Group ID

List of users, which are associated with the group.

STEP-VI(create the bash prompts in its home directory)
[[email protected]] # touch /var/spool/mail/techbrown

This will create a mail box for the user for techbrown so that the mail generated for user techbrown comes to this file.

Now use this command to login into user techbrown.

[[email protected] ~]# su - techbrown

[ctrl + d ]

[[email protected] ~]#

This shows the above error that is a bash error. Means to enter into the user, you should have some bash files into the home directory of the user. So do the following steps.

[[email protected] ~]# cd /etc/skel/
[[email protected] skel]# cp .bash* /home/techbrown
[[email protected] skel]# su - techbrown
[[email protected] ~]$ [you are in user techbrown ]

These are the steps to add user without the UserAdd Command.

Hot Right Now

Related Post