Well, guys, we have successfully changed our current root Debian 12 Linux password without knowing the old one. Let’s now restart the system properly. For that execute the given command on your terminal.
exec /sbin/init
Reset your forgotten root password for Debian 11 Bullseye server or desktop. Here are the commands to do so.
Forgotten passwords are usually inconvenient, especially when it comes to your computer password. As a result, you can no longer access your critical data.
Apart from that, losing access to the root account will also limit your access to perform system-critical tasks. Even modifying systems files and configuration will be limited. Well, I can understand the pain, and that’s why here in this article we will discuss the process of resetting the root password in Debian 12 Linux. So, that you can get back full control over your server or desktop.
A step-by-step guide to resetting the forgotten root password of Debian 12.
To reset the root password, first of all, we restart our Debian 12 system or virtual machine we are using. Soon as the system restarted, it will show you the Grub menu for a few seconds to select the advanced option. Press any arrow key to stop the system from further processing.
How to Reset the Root Password on Debian 9 Stretch
In this article, I will show you how to configure sudo, set root password, disable root login and reset root password. This can be done even if you don’t have sudo enabled and you don’t remember the password. Let’s get started.
Installing and Configuring sudo
Now type in your root password and press <Enter>.
The apt package repository cache should be updated.
It should be installed. In my case it is already installed.
The command should run as root as you can see from the screenshot below.
Setting Root Password
Now type in your desired root password and press <Enter>.
The root password should be set. Now you can login as root using your root password.
Changing Root Password
Now do the same things as you did on the Setting Root Password section of this article.
Disabling Root Login
Recovering Lost Root Password
If you happen to forget the root password and you don’t have sudo configured, then don’t give up just yet and think about reinstalling the operating system again. There is a way to reset the root password.
First reboot your computer. You should see the GRUB menu when your computer boots as shown in the screenshot below. Select Debian GNU/Linux and press e.
Now remove ‘ro quiet’ part from the end of the line and append ‘init=/bin/bash’ to the end of the line as marked in the screenshot below. Once you’re done, press F10.
remount,rw proc
Now type in your new root password and press <Enter> to continue.
Now re-type your new root password and press <Enter> to continue.
You root password should be changed.
Now press <Ctrl> + <Alt> + <Delete> and your Debian 9 Stretch machine should reboot.
Now you can login as root with your new root password as you can see in the screenshot below.
This is how you reset your root password on Debian 9 Stretch. Thanks for reading this article.
About the author
In that case, the root account can be a savior. But unfortunately, you are not getting the root password too. Now the only way is to reset the root password.
Today, you will learn to reset the root password in Debian 10/11 with a few simple steps.
Reset forgetten root Password
Reboot to Grub Bootloader
The foremost step is to restart your system into a grub menu. Once the boot menu appears, select the respective boot partitions in case of multiboot and press e to edit the kernel command line parameter.
Reboot to grub menu and press “e”
Add parameter
In the next screen, you need to find a line containing “ro quiet” and replace ro with rw, and after quiet, add a shell script location init=/bin/sh.
Update kernel parameter
Once it is done, press Ctrl-X or F10to boot into chroot environment.
Update password
Enter a new password for confirmation, type once again. If the password gets matched, you will see a message on stdout “passwd: password updated successfully”.
Type passwd command to update the password
The reboot and shutdown command will not work here, so press Ctrl+Alt+Del to reboot your system to regain your root privileges.
Troubleshoot
If the above method didn’t work out for you, and it prints some kind of error like “passwd: Authentication token manipulation error”.
To resolve this error, type the below command:
# mount -o remount,rw /
Remount rootpartitions
After that, type the passwd command to replace the root password and perform the reboot.
The above method should regain your password for the root account. And I believe this method will work on Debian 10/11 and Bedrock Linux.
A man with a tech effusive who has explored some of the amazing technology stuff and is exploring more. While moving towards, I had a chance to work on Android development, Linux, AWS, and DevOps with several open-source tools.
Modify GRUB to Reset the root password
To open the Grub Menu editing screen, press the ‘e‘ key on your keyboard. This will drop you on an editor, don’t touch or delete anything, just from here move to the next step.
Check file system permission
mount | grep -w /
The output must be with rw,realtime. It reflects that we have real-time- read-and-write access to the file system.
Finally, we will run the commands that will allow us to change the current forgotten root password of our Debian 12 Bookworm server or desktop system.
passwd
The command will ask you to type the password you want to set twice.
passwd h2s
How to Reset a Forgotten Debian 11 Root Password
1. Open Debian 11 Grub menu
To reset the password, we must first navigate to the Grub menu on our Debian 11 Bullseye. Restart your system while holding down the Shift key on your keyboard. This will take you to Debian 11’s Grub menu.
2. Edit Gurb Menu to Reset root password
3. Add rw init=/bin/bash
Use your arrow key to navigate to the end of the line beginning with “Linux” on the Grub editing screen. As seen in the screenshot, type rw init=/bin/bash at the end of this line.
rw init=/bin/bash
After adding the given syntax, next, boot your system with this configuration. For that either use Ctrl+X or F10.
How to Reset Root Password in Debian 11 10
4. Debian 11 Root shell Access
For that use a command:
mount | grep -w /
If the output is:
(rw,realtime) then it means you have real-time- read and write access to the file system.
5. Reset root user password
Now, let’s change the password as we do normally on a Linux system using the command terminal.
passwd
The system will prompt to add a new password two times:
How to Reset Root Password in Debian 11 11
passwd username
passwd debian
How to Reset Root Password in Debian 11 12
6. Reboot your system
Once you are done resetting your Linux password then restart your system to log in with the changed password. For rebooting, type:
exec /sbin/init
And that hit the Enter key.
You may now log in and access your system using the newly configured root password. This instruction will be beneficial for individuals who have lost or forgotten their root password and wish to change it. The instructions in this article will also work for other Debian 11 versions.
Do you want to learn more about this topic?
Steps to reset forgotten root password on Debian 11
To reset the password, first, we have to access the Grub menu of our Debian 11 Bullseye. Restart your system and while doing that press and hold the Shift key on your Keyboard. This will drop you into the Grub menu of Debian 11.
The next step is to edit the default boot entry of your Debian 11. For that press the ‘e’ key on your keyboard. This will let you edit the Grub’s boot prompt. Don’t touch or delete anything here. Once you have the editor move to the next step.
3. Add rw init=/bin/bash
On the Grub editing screen, use your arrow key and move to the end of the line starting with “Linux“. There at end of this line type – rw init=/bin/bash, as shown in the given screenshot.
rw init=/bin/bash
After adding the given syntax, next, boot your system with this configuration. For that either use Ctrl+X or F10.
4. Debian 11 Root shell Access
For that use the command:
mount | grep -w /
If the output is:
(rw,realtime) then it means you have real-time- read and write access to the file system.
Now, let’s change the password as we do normally on a Linux system using the command terminal.
passwd
The system will prompt you to add a new password two times:
passwd username
passwd debian
6. Reboot your system
Once you are done resetting your Linux password then restart your system to log in with the changed password. For rebooting, type:
exec /sbin/init
And that hit the Enter key.
From here onwards, you can log in and access your system with the newly set root password. This guide would be useful for those who somehow lose or forgot the root password and now want to change the same. The steps given in this article will also work for other Debian 11 versions as well.
•Install PowerShell on Debian 11 Bullseye Linux •Install phpBB forum on Debian 11 Bullseye •How to install Telegram on Debian 11 Bullseye •Forgot Your Linux Mint password- Here is a way to recover it.
Add rw init=/bin/bash to Debian 12’s Grub
You will see a couple of lines that tell the system how to boot itself, so don’t edit anything arbitrarily. Instead, use the arrow keys and move to the end of the line starting with “Linux“. At the end of this line after ro quiet type –
rw init=/bin/bash
To have an idea you can see the given screenshot. Once you are confirmed that the added line is exactly, what we have shown here in the screenshot. After that boot your system with these added changes by pressing F10.
You might like to know what is “rw init=/bin/bash” is that we have added. It is a Linux boot option that tells the system to run the and drop us in a shell (“/bin/bash”) with read and write permissions (“rw” or read-write) to the file system. Whereas, the “init” in the command is the first process that runs when the operating system is booted, and it is responsible for starting and managing other processes.