Saturday, April 20, 2024
HomeTutorialsHow To Change Root Password in Kali Linux

How To Change Root Password in Kali Linux

The Kali Linux is based on the Debian distribution. This operating system is famous mainly among young users, developers, and hackers. Many ethical hackers use the Kali Linux system for security and stability. The root password is the primary password that you use to install software, do repository updates, and perform other administrative tasks on the system. Usually, if you are the root user, it’s conventional that you will have access to change the root password,  but most users, if they are new to Kali, face issues changing the password. There are very simple tips and tricks and methods that you can follow to change the root password in Kali Linux.

Change Root Password in Kali Linux

Changing the root password and recovering a forgotten password from the bootloader GRUB is not the same. In the conventional way to reset the system password from the bootloader, we usually use a live USB device of the operating system and boot into the live session to crack the password.

We have already seen how to change the root password and how to recover the password of a Ubuntu Linux system if you have forgotten the password. In this post, we will see the easiest and most efficient way to change the root password in Kali Linux.

wrong password Change Root Password in Kali Linux

Method 1: Change the root Password Using the passwd Command

The very first method of changing the root password of Kali Linux is that we will use the conventional passwd command on a terminal shell. This command will allow us to change the root password on our system if we know the existing password. 

This step is very simple and straightforward; all you need to do is open up your terminal shell and execute the below-mentioned passwd command, and hit the enter button. 

Please note, in the command, I used the username as root because I want to change the password of the root user; if you want to change the password of any other users, you might need to replace the username in the last part. 

sudo passwd root

sudo passwd root

The above-mentioned command will give you the option to enter your current password and then set up a new root password for the system. Once you are done changing the root password, you may need to reboot your entire system. To reboot your system, please hit the below-mentioned reboot command on your terminal shell. Here, the -f flat indicates that we are going to reboot the system forcefully.

reboot -f

That’s all you need to do to change your root password. Now, after you reboot, when it comes back to the boot window, you will need to use your updated password to login into your system as the root user.

Method 2: Change the root Password using the GRUB

In the earlier method, we have seen how to change the root password when you are logged in, and you know your existing root password. What will happen if you are not even signed in and you forget your password? How to recover that root password in Kali Linux?

There will be options to do that with the bootable GRUB option. In short, the method we will apply the same passwd command, but from the GRUB bootloader with no signing in.

To go to the grub bootloader option on a Linux system, press the E button while you restart the computer. It will directly take you to the grub configuration page.


Now use the arrow keys to scroll the script and find the line that starts with linux /boot/vmlinuz.

Find Linux Change Root Password in Kali Linux

Then, go to the end of that line and replace the ro with the rw as shown in the image below. Then remove the splash and replace it with the syntax init=/bib/bash. You can now press the ctrl + X buttons together to save the changes.

rw Change Root Password in Kali Linux

You will now be directed to the root user account setting page on the shell. Now, we will use the password-changing command on the shell. You can use the below-mentioned command to change the root password.

sudo passwd root
reboot -f

GRUB command

Final Words

Changing the root password of any operating system is an administrative task; if you are doing this out of curiosity, I must note that you should be careful before doing this. If you are not the system administrator, and if there are other sub-systems with your computer, please notify the other users that you are going to change the root password so that they do not face issues on their end.

In the entire post, we have seen a few very efficient methods of changing the root password in Kali Linux. If you are a professional and expert user, you can also use the same procedures to change the root password on any other distributions as well.

If you find this article has been useful for you, please do not forget to share this post with your friends and the Linux community. We also encourage you to write down your opinions in the comment section regarding this article.

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.


Please enter your comment!
Please enter your name here

You May Like It!

Trending Now