How to create a new user with sudo permissions (root privileges) on Kali Linux

So, you want to create a new user with sudo (root) privileges on Kali Linux? Follow the steps below:

1. open the terminal window by pressing “ctrl + alt + t” at the same time on your keyboard.

2. switch to the root user

sudo su

*If you are prompted to provide a password after typing the ‘sudo su’ command, type the password for your current user that you are logged in as. In my case, I will provide the password for farhan.

3. We can now create a new user. To create a new user, type the command ‘adduser name_of_the_user’. I will be creating a user called “john”. So my command would be:

adduser john

4. Set the password for your new user. After the password has been updated, you will be asked to provide optional information such as Full Name, Room Number, etc. I will not provide and keep them as defaults. Keep pressing “Enter” to proceed with the defaults. Finally, you will be asked “Is this information correct?”, press “Y” and then press “Enter”. Now, you have a new user created.

5. Add the newly created user(in my case, john) to the sudo group with the command ‘usermod -aG sudo name_of_the_user’

usermod -aG sudo john

*The user john has now been added to the sudo group. The user john can now execute the sudo commands

6. Switch to the user with the command ‘su name_of_the_user’. After you switch the user, verify the user has sudo privileges by running a command with sudo. You will be prompted for a password, type the password you set earlier in step 4. If the command gets executed successfully, you have successfully created a new user with sudo(root) privileges.

su john
sudo apt update