Adding/Removing users from command prompt on Linux

Recently I installed Kali Linux and found that by default we will be logged in with root and we continue to work in root, which might be not so good idea. So here is a way to create new users, assign password to the new user account and giving su rights to the newly created user.

Here are the steps to follow:

1. While logged in as root, Open a terminal using Ctrl+Alt+T or clicking on the icon on the dock

2. Add a new user using:

useradd -m <username>

-m to create the user’s home directory, replace <username> with new username

3. Create a password for the username created in step 2:

passwd <username>

4. Add the user to the sudo group (to install software etc):

usermod -a -G sudo <username>

-a to add and -G mentions the group name to be added to

5. Now finally change the default shell of the newly added user to bash:

chsh -s /bin/bash <username>

-s to provide a new login shell for the user account

Logout from root and login with newly created username and password and you are ready to go.