TRENDING
  • Linux
  • Shell Script
  • Cloud
  • DevOps
  • About US
SUBSCRIBE
  • CLOUD
  • DEVOPS
  • LINUX
  • SHELL SCRIPT
Reading: How to Create User without using Useradd Command on AlmaLinux / Rocky Linux
Share
TechBrownTechBrown
Aa
  • CLOUD
  • DEVOPS
  • LINUX
  • SHELL SCRIPT
Search
  • CLOUD
  • DEVOPS
  • LINUX
  • SHELL SCRIPT
Follow US
© 2014 - 2022 TechBrown. All Rights Reserved.
Linux

How to Create User without using Useradd Command on AlmaLinux / Rocky Linux

February 2, 2015
Share
6 Min Read
SHARE
Contents
Step-1 (Add user using UserAdd Command)Step-2 (Normal User Login)STEP-3 (The system creates a directory with the name of ‘user’ in “/home” directory)STEP-4 (Creates an entry in /etc/passwd file)STEP-5 (Creates an entry in /etc/shadow file)STEP-6 (Creates an entry in /etc/groups file)STEP-7 (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’”)STEP-8 (create the bash prompts in its home directory)

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 AlmaLinux / Rocky Linux / Amazon Linux by following the steps carefully.

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.
Step-1 (Add user using UserAdd Command)
# useradd techbrown
# 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-2 (Normal User Login)
# su – gopal

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-3 (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

# mkdir /home/techbrown

It will create a home directory for user techbrown

STEP-4 (Creates an entry in /etc/passwd file)
# 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-5 (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.

# 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

:wq
Here in “/etc/passwd“file you have to create 7 entries. Let’s discuss about it shortly.
Username
It indicates that the password is encrypted and stores in a shadow file
User ID
Group ID
Comment
Home directory of the User
Last one shell prompt you can check it through “/etc/shells” file.

STEP-6 (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.

# vim /etc/shadow

Now make entry in this file.

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

:wq!
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
since 1 January 1970 that the password last changed.
permitted before the password can be changed.
after which the password must be changed.
before the password expires that the user is warned.
after the password expires before the account is disabled.
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

# grub-md5-crypt
password:[type your password]
retype password : [type above password again]
$1$YgGpm1$hhDEbeY0mRpKccgyQsWQn0

Now copy and paste this password in this section.

STEP-7 (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.

# vim /etc/groups
techbrown :x : 501:
1 :2 : 3 :4

:wq
Here 1:2:3:4 as
Username
Password
Group ID
List of users, which are associated with the group.

STEP-8 (create the bash prompts in its home directory)
# 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.

# su - techbrown
-bash-4.1$

[ctrl + d ]

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.

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

Congratulations now you have created the user without useradd command onAlmaLinux / Rocky Linux / Amazon Linux.

You Might Also Like

How to Optimize MySQL Performance on AlmaLinux / Rocky Linux

How to Enable TLS 1.3 on Apache and Nginx

5 Security Tips to Protect your WordPress Website from Hackers

How to Enable AES-128 Bit SSL Cipher with TLS 1.3 on Nginx Web Server

How to Set Up NGINX Web Server on AlmaLinux / Rocky Linux

Sign Up For Newsletter

Be keep up! Get the latest articles delivered straight to your inbox.

TechBrown Solutions February 2, 2015
Share this Article
Facebook TwitterEmail Print
Share
Leave a comment Leave a comment

Leave a Reply Cancel reply

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

TRENDING

Linux

How to Repair Corrupted GRUB on RHEL / AlmaLinux / Rocky Linux

Linux

How to Enable Persistent Object Cache using Redis on WordPress

Linux

How to Configure Master and Slave LDAP Server on AlmaLinux / Rocky Linux

Shell Script

Bash Script to Install Qmail Server on AlmaLinux / Rocky Linux

You Might Also Like

Linux

How to Optimize MySQL Performance on AlmaLinux / Rocky Linux

October 19, 2021
Linux

How to Enable TLS 1.3 on Apache and Nginx

March 14, 2021
Linux

5 Security Tips to Protect your WordPress Website from Hackers

November 8, 2020
Linux

How to Enable AES-128 Bit SSL Cipher with TLS 1.3 on Nginx Web Server

November 7, 2020

Always Stay Up to Date

Subscribe to our newsletter to get our newest articles instantly!

Follow US on Social Media

Facebook Twitter Youtube Rss

© 2014 - 2022 Techbrown. All Rights Reserved.

  • About Us
  • Terms of Service
  • Cookie Policy
  • Privacy Policy
By using this site, you agree to the Privacy Policy, Cookie Policy and Terms of Service.
Accept

Removed from reading list

Undo
AdBlock Detected
Our site is an advertising supported site. Please whitelist to support our site.
Okay, I'll Whitelist
Welcome Back!

Sign in to your account

Lost your password?