Kali Linux

How to Change Root Password on Kali Linux

How to Change Root Password on Kali Linux

Securing your Linux system with a strong password is crucial for protecting your data and ensuring the integrity of your system. By default, the credential to login into the Kali Linux system is kali for both username and password. However, these credentials can only be applied for the default system user that doesn’t have root privileges, preventing you from editing critical system files.

To run the advanced system-related tasks, you are required to enter the system as root user, which can only be possible if you know the root password. By default, on all latest Linux distributions, including Kali Linux, the root account is locked for protecting the system. This is the reason you won’t be able to set the root password at the start of your installation. However, this doesn’t mean that you won’t be able to access the system as a root user, you can change the root password any time and start taking control over the system.

In this guide, you will learn:

How to Change Root Password on Kali Linux

You can change root password on Kali Linux from:

How to Change Root Password on Kali Linux from Terminal

To change root password on Kali Linux from terminal, use the following steps:

Step 1: First open terminal on your Kali Linux system and hit the below-given command:

sudo passwd root

Step 2: Enter the new password for root on your Kali Linux system:

Step 3: Retype the new password again you set in the previous steps:

This will successfully set the root password on your Kali Linux system, as shown from the output:

The same method can be followed if you want to set a password for the root user on the Kali Linux system. Simply replace root with the username to change the password for the system user on Kali Linux.

How to Change Root Password on Kali Linux from GRUB

Besides changing the root password on Kali Linux from the terminal, you can also use the Linux GRUB menu to change the root password. This method is useful for the users who have forgotten their root or user password and failed to login to the system. You can follow the below-given steps to change root password on Kali Linux from the GRUB menu:

Step 1: First start your Kali Linux system normally either on a computer or Virtual Machine:

Step 2: At the GRUB menu, simply use E button from the keyboard, this will move your towards the GRUB editing mode:

Step 3: Now, find the line linux in the GRUB editing mode by scrolling down the menu:

Step 4: Here, replace the keyword ro (read) with rw (read and write), init=/bin/bash in place of quiet to force start the system in terminal mode. You should also ensure removing the splash keyword from the line, the final line will be like this:

rw init=/bin/bash

Step 5: Now, use CTRL+X simultaneously to save the changes and move back to the GRUB menu and start the Kali Linux system. When the system starts again, it will forcefully run in the terminal mode:

Step 6: In the terminal mode, use the below-given command to change the root password for Kali Linux system:

passwd root

Note: You can also change the user password from the GRUB menu by simply replacing the root with your respected username created on the Kali Linux system.

Step 7: Enter the new password, then retype the new password again to change the root password on Kali Linux system:

Step 8: Once the root password is changed, reboot the Kali Linux system from the following command:

exec /sbin/init

Note: It is important for you to keep in mind that the default reboot command will not work here, the reason is the current Kali Linux system is not booted with systemd as init system. If you try to run the reboot command instead of exec /sbin/init, you will encounter the following error:

Conclusion

Changing the root password on the Kali Linux system may compromise your system security in case the password is not too strong. If you are sure about your Kali Linux system security, then you can change the root password on the Kali Linux system from the terminal or GRUB menu. From terminal, simply login into your user account and change the root password by executing the sudo passwd root command. From GRUB, use the E button at the GRUB menu and replace the “ro quiet splash” line with “rw init=/bin/bash”. Then save the changes and force the system to boot into the terminal. At the terminal, use the passwd root command to change the root password on the Kali Linux system. Once done, reboot the system using “exec /sbin/init” command and login to root user with the new password.

 

Similar Posts