How to create a user without useradd command on Debian 11.3
To Create A User Without Useradd Command On Debian 11.3
Introduction:
In Linux, the useradd command is one of the most popular commands for adding a new user. Contrary to popular belief, it is possible to create a user without using the useradd command. The purpose of this tutorial is to show you how to create a user without using the useradd command.
Procedure:
Step 1: Check the Oracle Linux version by using the below command
[linux@linuxhelp ~]$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
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 by using the below command
[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: Check the Encrypted password for user1 by using the below command
[root@linuxhelp linux]# cat /etc/shadow | grep user1
user1:$y$j9T$BcbPeb/pFdnDrIzK73rjs0$SSqEI7hvcj30nGX03VMnmlxNVBZiconxWbwyWfpMY.:19259::::::
Step 6: Switch over user1 by using the below command.
[root@linuxhelp linux]# su user1
User1@linuxhelp:/root$
bash-4.4$ 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:/home/user1]# cp -v /etc/skel/.bash* .
'/etc/skel/.bash_logout' -> './.bash_logout'
'/etc/skel/.bashrc' -> './.bashrc'
Step 10: Now switch over to user1 by using the below command
[root@linuxhelp :/home/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 Debian 11.3 Your feedback is much welcome.
Comments ( 0 )
No comments available