Readers like you help support MUO. If you make a purchase through links on our site, we may receive an affiliate commission. Continue reading.
A system protected by default credentials is an open invitation for attackers to exploit it. It is highly recommended that you set a custom root password for your Kali Linux computer as soon as it boots up after installation.
In this introduction, you will find the easiest and fastest way to change the root password of your Kali Linux desktop using the passwd command or if you forgot your root password, using the GRUB bootloader.
What is the default Kali Linux root password?
To change root password or customize the system, you need to know the current default root password in Kali Linux.
According to the official documentation and assuming your system has not been tampered with, the default root password in Kali Linux is Kali.
Change the Kali Linux root password using the passwd command
A quick way to change Kali Linux root password is to use the built-in passwd command. With passwd you can change the password of any user on Linux, root or not.
To do this, launch the terminal and run the passwd command with superuser privileges:
sudo passwd root
Enter your current root password when prompted. Enter the new root password. Make sure your password is unique and long. If you’re not sure what to set as a password, you can use built-in Linux programs that will generate strong passwords for you.
Confirm your new password and complete it with Input.
That’s all you have to do. Your Kali Linux root password has been set to the one you just entered. Enter any command with superuser privileges and see for yourself.
Similarly, you can change other users’ password using the passwd command on Kali Linux. All you have to do is follow the passwd command with the name of the user whose password you want to reset. The remaining steps are identical.
Change Kali Linux Root Password with GRUB Recovery
The method discussed earlier involves the use of superuser privileges. This means that you need to know the root password in order to run the passwd command and for the process to work. But what if you forgot your Kali Linux root password and want to reset it? The passwd command will then be of no use to you.
Don’t fret, though, because you can reset your forgotten root password via GRUB bootloader recovery mode.
Restart your Linux desktop and in the GRUB bootloader menu press the E Button. That should open the GRUB configuration file.
Use the arrow keys to navigate the wall of text until you find a line that begins with the word Linux.
Replace on this line red with rw, quiet with init=/bin/bashand delete syringes. Essentially you are telling the GRUB bootloader to mount the root partition with read/write permissions and initialize a bash shell.
Once you have the bash shell, use the passwd command to change the root password. Only this time, the system will not prompt you for the current root password:
sudo passwd root
Enter your new password and complete it with Input. When finished, reboot your system using the reboot command:
That’s all you have to do. Once you boot up, you should find that your root password has been changed to the one you just entered. Run any command with superuser privileges to check it yourself.
Secure your Linux system with root passwords
Securing your system with account hardening measures like setting unique root passwords, disk encryption, etc. should be your top priority after booting Linux for the first time.
You should not forget to implement some of the most important security measures on your Linux system to improve user account security.
This article was previously published on Source link