How to create a user without useradd command on Oracle Linux 8.5

To Create User Without Useradd Command On Oracle Linux 8.5

Introduction:

useradd is a command in Linux that is utilized to add user accounts to your system. In Linux, it is simply a symbolic link to the adduser command. This tutorial will show you how to create a user without using useradd.

Installation Procedure:

Step 1: Check the Oracle Linux version by using the below command

[linux@linuxhelp ~]$ cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.5"
 [linux@linuxhelp ~]$ 

Step 2: Enter the user Details in the following location by using the below command

[root@linuxhelp linux]# vim /etc/passwd
user1:x:500:500:testuser:/home/user1:/bin/bash

Step 3: Create Group user by entering the Details in the below location

[root@linuxhelp linux]# vim /etc/group
user1:x:500:

Step 4: Create password for the user1 by using the below command

 [root@linuxhelp linux]# passwd user1
Changing password for user user1.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

Step 5: To check the Encrypted password for user1 use the below command

[root@linuxhelp linux]# cat /etc/shadow | grep user1
user1:$6$jvUR9CPF82zqMDzh$bl.v/7T86Ou3kJ/kfTfj56CZSNszF3Iz1dAJCam/Rwr.0RIiUhBucZosUM4doj23qiAH3mVtswPFH6kstL/qI1:19244::::::

Step 6: Switch over user1 by using the below command.

[root@linuxhelp linux]# su user1
bash-4.4$ 
bash-4.4$ 
bash-4.4$ 
bash-4.4$ 
bash-4.4$ exit
exit

Step 7: Create home directory for user1 by using the below command

[root@linuxhelp linux]# mkdir /home/user1

Step 8: Change Directory to user1 by using the below command

[root@linuxhelp linux]# cd /home/user1

Step 9: Now copy the bash file to the current user1 directory by using the below command

[root@linuxhelp user1]# cp -v /etc/skel/.bash*.
'/etc/skel/.bash_logout' -> './.bash_logout'
'/etc/skel/.bash_profile' -> './.bash_profile'
'/etc/skel/.bashrc' -> './.bashrc'

Step 10: Now switch over to user1 by using the below command

[root@linuxhelp user1]# su user1
[user1@linuxhelp ~]$ 
[user1@linuxhelp ~]$ 
[user1@linuxhelp ~]$

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to create user without useradd command on Oracle Linux 8.5. Your feedback is much welcome.

FAQ
Q
What is the purpose of /etc/skel/ ?
A
The /etc/skel/ contains some hidden files which have profile settings and default values for applications. Hence, it serves as a default home directory and user profile While using useradd.
Q
What is the purpose of useradd -D?
A
to display content in /etc/default/useradd
Q
What is useradd command used for?
A
In Linux, a 'useradd' command is a low-level utility that is used for adding/creating user accounts in Linux and other Unix-like operating systems.
Q
How to filter manually created user from /etc/passwd?
A
cat /etc/passwd | grep '/home'
Q
Is there any other command to create a user other than useradd?
A
adduser username is also used to create a new user