A system protected by default credentials is an open invitation for adversaries to exploit. It is highly recommended that you set a custom root password for your Kali Linux machine as soon as it boots up post-installation.
In this primer, you will find the easiest and swiftest way to reset the root password of your Kali Linux desktop with the passwd command or, if you forgot your root password then with the GRUB bootloader.
What Is the Default Root Password in Kali Linux?
To change the root password or customize the system, you will need to know the current, default password in Kali Linux.
As per the official documentation, and given that your system hasn’t been tampered with, the default root password in Kali Linux is kali.
Change the Root Password Using passwd
A quick way to change the root password on Kali Linux is to use the built-in passwd command. With passwd, you can change the password of any user, root or not, in Linux.
To do that, fire up the terminal and run the passwd command with superuser privileges.
sudo passwd root
Enter your current root password when prompted. Type in the new root password. Make sure your password is unique and lengthy. If you are unsure what to set as a password, you can make use of in-built Linux programs that generate secure passwords for you.
Confirm your new password and finalize it by hitting Enter.
That’s all you need to do. Your Kali Linux root password has been set to the one you just entered. Type in any command with superuser privileges and see for yourself.
Similarly, you can change the password of other users using the passwd command on Kali Linux. All you need to do is to follow up the passwd command with the name of the user whose password you wish to reset. The rest of the steps are identical.
Reset a Forgotten Root Password With GRUB
The previously discussed method entails using superuser privileges. That means you have to know the root password to execute the passwd command and thus, for the process to work. But what if you forgot your root password and wished to reset it? The passwd command won’t be of any use to you then.
Fret not though, for you can reset your forgotten root password through the GRUB bootloader recovery mode. Here’s how:
Restart your Linux desktop and in the GRUB bootloader menu, press the E key. That should open up the GRUB configuration file.
Navigate through the wall of text with arrow keys till you find a line starting with the word linux.
In that line, replace ro with rw, quiet with init=/bin/bash, and erase splash. Essentially telling the GRUB bootloader to mount the root partition with read and write permissions and initialize a Bash shell.
Once you have the Bash shell, use the passwd command to change the password. Only this time around the system won’t prompt you for the current root password:
sudo passwd root
Type in your new password and finalize it by hitting Enter. Once done, restart your system with the reboot command:
That’s all you need to do. Once you boot up, you should find your root password changed to the one you just typed in. Run any command with superuser privileges to check it yourself.
Securing Your Linux System With Root Passwords
Securing your system with account hardening measures such as setting unique root passwords, disk encryption, etc. should be your top priority after booting into Linux for the first time.
We have curated a list of the top-most security measures you should implement on your Linux system to improve user account security.
5 Ways to Improve Linux User Account Security
About The Author