How to Change Root Password in Kali Linux?
Last Updated :
18 Sep, 2024
Securing your Kali Linux system is crucial for protecting sensitive data and maintaining the integrity of your environment. One of the fundamental aspects of system security is regularly changing the root password. The root account in Linux has superuser privileges, making it a prime target for attackers. By changing the root password periodically, you can significantly reduce the risk of unauthorized access.
Here, we’ll walk you through the steps to change the root password in Kali Linux, providing detailed instructions to enhance your system’s security.
How to change the root password in Kali Linux?
After completing the installation of the Kali Linux machine, the most highly performed task and asked question is to change the root password of your Kali Linux machine.
Note: This is not exclusive only to Kali Linux machines, you can perform the steps in any Linux machine with grub, we are using Kali as an example.
The default credentials for logging into the new Kali machine are username: "kali" and password: "kali". This opens a session as user "kali" and to access root you need to use this user password following "sudo".
Changing the root password is easy, but you need to ensure these few things:
- Active GRUB Bootloader: You need an active GRUB bootloader to modify boot parameters.
- Unlocked Bootloader: The bootloader must not be locked to allow modifications.
Method 1: Changing the Root Password via GRUB
This method involves editing GRUB settings to boot into a root shell with full privileges.
Step 1: Boot into GRUB Menu.
Restart your Kali Linux machine and wait until the GRUB menu appears. Do not select any options or boot into Kali immediately.
Step 2: Edit GRUB Entries
Now you need to edit the grub entries, so you can spawn a root session. Press "e" key to enter edit mode.
Step 3: Modify Boot Parameters
Now you need to find the keyword "linux", in our case you can see that the last line starts with "linux", which is kernel selection. In our case "/boot/v,linuz-5.5.0.0-kali2-amd64" represents our active kernel.
Navigate in the line to "ro" (read only) and replace it with "rw" (read and write).
In the same line navigate to "quite splash" and replace it with
init=/bin/bash
These changes are not saved permanently and grub uses default configurations, once you have made these changes press key "f10" to boot. This will create a terminal session with root privileges.

Step 4: Change the Root Password
Once you are in the terminal session you just need to enter the command:
passwd root

After applying your new password reboot your system using the following command:
exec /sbin/init
reboot
Method 2: Changing the Root Password from the Terminal
This method involves using the terminal to switch to the root user and update the password.
Step 1: Open the Terminal
First open your kali Linux terminal.
Step 2: Switch to Root User
Then type the following command and press Enter to switch to the root user.
sudo su
After this you will be prompted to enter your user password. Enter the password and enter into your root user.
Step 3: Change the root password
Once we have switched to the root user, we need to use the following command to change the root password
passwd
Now we will be prompted to enter the new root password. Try to enter strong passwords, after that we need to enter the desired password again for confirmation.
Step 4: Verify the Password Change
To ensure that the root password has been changed successfully, you can:
- Open a new terminal session and try logging in as the root user.
- Reboot the system to make sure all changes are applied correctly.
Conclusion
In this article, we have discussed changing our root password in Kali Linux which is crucial for data protection and system integrity. And after discussion we can say that changing our root password regularly is important for security. One can easily change their root password by understanding and following steps discussed in this article. Overall, we can say that we can strengthen the security of our Kali Linux System.
Similar Reads
How to Change Time in Kali Linux Kali Linux is a popular Debian-based Linux distribution used for pen-testing and ethical hacking. It is developed and maintained by an American cybersecurity firm, Offensive Security. Kali Linux comes pre-installed with various tools and software required for penetration testing and ethical hacking,
4 min read
How to Root in Kali Linux? Every Linux Distribution comes up with a dedicated account service where all the Administrative Privileges of Linux are kept. And the Debian Linux Distribution, Kali Linux is not also different from that. If you want to get all the Administrative Abilities in Kali Linux, you have to perform Root in
4 min read
How to Reset Forgotten Password on Kali Linux Kali Linux is a Linux distribution used in the Cybersecurity domain. It is maintained and funded by Offensive Security. Kali Linux is Debian based and it uses the Debian repository for most of its packages. This Linux distribution is designed for digital forensics and penetration testing. It has 600
4 min read
Kali Linux - Password Cracking Tool Password cracking is a mechanism that is used in most of the parts of hacking. Exploitation uses it to exploit the applications by cracking their administrator or other account passwords, Information Gathering uses it when we have to get the social media or other accounts of the C.E.O. or other empl
5 min read
How to take a Screenshot in Kali Linux Kali Linux is a Debian-based distribution with a strong focus on penetration testing, ethical hacking, digital forensics, and more. The project is maintained by Offensive Security. Unlike Debian which focuses on servers and desktop usage, Kali has a strong focus on Cyber security. With lots of prein
5 min read
How to Change the username or userID in Kali Linux? Kali Linux, a popular Linux distribution for penetration testing and ethical hacking, allows users to create a username during installation, automatically assigning a unique User ID (UID) to each user for identification. However, there are situations where you might need to change the username or us
4 min read