Securing our Kali Linux System is very important for protecting our data and ensuring the integrity of our system. One of the most essential aspects of securing our system is changing the root password regularly. We know that the root account in Linux has superuser privileges and is often targeted by attackers. We can prevent this by changing the root password regularly.
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:
- You are using an active grub boot loader
- Your bootloader is not locked.
If everything is okay, then just follow the steps:
Step 1: Boot into your machine to grub the menu, do not choose anything or boot into Kali.
Step 2: Now you need to edit the grub entries, so you can spawn a root session. Press “e” key to enter edit mode.
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-188.8.131.52-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
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 3: Once you are in the terminal session you just need to enter the command:
After applying your new password reboot your system using the following command:
Another method to Change root password.
Switch to root user
First open your kali Linux terminal.
Then type the following command and press Enter to switch to the root user.
After this you will be prompted to enter your user password. Enter the password and enter into your root user.
Change the root password.
Once we have switched to the root user, we need to use the following command to change the root password
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.
To verify that password in changed successfully we need to open a new terminal and try to login in root user.
We can also verify it by rebooting our system. It is generally good to reboot our system after changing root password to ensure all changes take effect.
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.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!