How to Change Username on Kali Linux

To change your username on Kali Linux, follow the steps below:

1. When you start your Kali Linux machine, log in as the root user instead of your regular user.
Note: If you do not have root login enabled, read this article first: https://debianninja.com/how-to-set-root-password-and-enable-root-login-on-kali-linux/

2. After you are logged in as the root user, open your terminal window by pressing ‘Ctrl+Alt+T‘ at the same time on your keyboard.

3. To change your username, use the command ‘usermod -l new_username old_username‘, replacing ‘new_username’ with your desired username and ‘old_username’ with the username you want to change.

usermod -l new_username old_username

*I want to change my current username ‘farhan’ to my desired username ‘hackerboy’, so the command for me is ‘usermod -l hackerboy farhan’.

4. Optional: If you want to change the home directory name to match the new username, you can do so with the following command:

usermod -d /home/new_username -m new_username

*This command renames the home directory to match the new username. Since my new username is hackerboy, I want my home directory name to also be hackerboy.

5. Optional: If you want to change the group name, which is often the same as the user’s name, use the following command:

groupmod -n new_username old_username

*Now, my group name has been changed from farhan to hackerboy.

6. Optional: You can update the user’s details, such as the full name:

usermod -c "New Full Name" new_username

*Replace “New Full Name” with the desired full name for the user. I will give my new user (hackerboy) the full name “HACKER BOY”.

7. After making the changes, log out and log back in again with the new username you just set.

That’s it. This is how you change the username on kali linux.