How To'sLinux

How to Create a New User in Kali Linux?

In this article, we’re going to create a user account and assign root privileges in Kali Linux. The default user account created by Kali Linux is (kali/kali) as credentials and previously it was (root/toor) but now it no longer exists.

Let’s create our new user account by invoking useradd command.

  • sudo useradd username # Create New User

This command will execute and include data to /etc/passwd, /etc/shadow, /etc/gshadow, and /etc/group files.

Now that you have created a user account. Further, to be able to log in, you need to set the user password.

For that, run the following command:

  • sudo passwd username # Create Password For Username

You’ll be prompted to enter a new password.

How to Create a New User and Create Home Directory

To create a user account with the home directory we’re gonna use the -m (--create-home) option to create a user with the directory /home/m4sterph0enix:

  • sudo useradd -m m4sterph0enix

Add User to Sudo Group

After successfully creating a user account, now we’re going to add that user to sudo group. This is to assign root privileges to that user account that we just created, and add that to bash.

sudo m4sterph0enix
/bin/bash m4sterph0enix

After switching users through the terminal we can use id or whoami to see if it has created a user account and what sorts of permission it has.

id
whoami

Now, simply logout from the kali user to login back to the user which you just created: m4sterph0enix

Login with the credentials which you used to create your new user account in Kali Linux.

After successful login, you can see our bash terminal has m4sterph0enix user id and has sudo permissions to it.

Hence, we’ve shown you how to create user accounts using the useradd command and these instructions apply to any Linux distribution, such as Ubuntu, Debian, CentOS, RHEL, Fedora and etc. However, Ubuntu and Debian users can use adduser tool instead which is easy to use.

Noor Qureshi

Experienced Founder with a demonstrated history of working in the computer software industry. Skilled in Network Security and Information Security.

Related Articles

Back to top button