How to reset root password in Debian 11 Bullseye

In this post, we will how to reset forgotten root password on Debian 11.

Let’s now see how you can reset a forgotten root password in Debian 10 or 11. For demonstration. We will use Debian 11.

How do I find my root password in Linux?

How to log in without a root password Linux, if I have sudo access?

How to change the root password in Linux?

Forgotten passwords are always annoying – especially when it comes to your computer password. So you can no longer access your important data.

Restart the system and login as root

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.

In this tutorial, we have demonstrated the guidelines for resetting the root password in Debian 11.

Here are the steps to reset the forgotten root password in Debian 11:

Step 1: First, you must access the Grub Menu to reset the forgotten root password in Debian 11. Restart the system and press the shift key while restarting the device.

Step 2: The next step is to edit the grub menu, and press the e key when this screen appears:

Step 3: Use the arrow keys to move up and down on the editing screen. Scroll down the menu until you move to the line that starts with Linux. Look at the end of this line you will find ro quiet, you have to edit this string.

Step 4: Replace the string with init=/bin/bash at the end of the line as shown in the screenshot:

Step 7: Enter the new password twice and hit Enter. The message will pop up “Password updated successfully”:

Bottom Line

About the author

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>.

Now retype the root password and press <Enter>.

The root password should be set. Now you can login as root using your root password.

Дополнительно:  [Решено] 18 решений, чтобы исправить синий экран смерти на Windows 10/8/7 / XP Fix

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

Есть ноутбук на котором стоит Debian 10. Используется сей девайс как дежурная приблуда для подключения к разному железу и сервакам, в том числе. Иногда такая необходимость бывает редко, но вот приспичило сегодня, а пароль не вспомнить от root. Пароль пользователя тоже не известен, вход в систему настроен автоматически. Будем делать сброс пароля — назначим новый.

Ранее была статья про восстановление пароля в Ubuntu, здесь по идее та же логика.

Для сброса пароля нам понадобится ниже описанная инструкция и мозги, ну и конечно прямые руки

Различные live сборки и прочее не понадобится, если у вас не вносились изменения в загрузчик Grub 2. О нюансах по ходу дела.

Итак инструкция Debian 10 сброс пароля

При включении системы во время отображения меню Grub, варианты запуска. Нажимаем клавишу «E», латинского алфавита.

сброс пароля debian 10

Если такое меню не появляется то удерживайте клавишу shift при загрузке.

Мне пришлось загрузится с помощью live сборки mint и подправить время вывода этого меню в конфиге grub 2. Я сам ставил время равное нулю, по своим соображениям.

Конфиг располагается /boot/grub/grub.cfg

Параметр: set timeout=10

Теперь в открывшихся параметрах загрузки системы в строке которая начинается с linux в конце после quiet ставим пробел и пишем следующее (передвигать курсор мне пришлось стрелками, Мышь в данном варианте не работает)

сброс пароля debian 10
init=/bin/bash

после нажимаем ctr+x или f10, в моем варианте сработало первое, второе я не пробовал.

Загрузится система и перед вами будет командная строка, решетка означает, что работает в данный момент терминал с правами супер пользователя.

командная строка root

Вводим команду на монтирование нашей файловой системы с правами не только для чтения, но и для записи, соответственно и внесения изменений

mount -rw -o remount /

Теперь приступим непосредственно к к изменению пароля root, просто введем команду

passwd

без всяких имен и дополнений, нажмем Enter, и на вопрос new password, введем новый пароль (набранный пароль вы не увидите, в Linux не отображаются пароли)

Затем нас спросят подтвердить введенный пароль путем повторного его ввода, вводим повторно и снова нажимаем Enter.

Если все сделали правильно то увидим такой ответ «pasword updated successfully»

сброс пароля

Не торопитесь !

Теперь отмонтируем файловую систему командой

umount /

Ну и перезагрузим систему командой

reboot -f

После смены пароля пользователя root, сменить пароль любого пользователя не составит труда

Для смены пароля пользователя, после загрузки системы, наберите в терминале от имени root команду

passwd имя_пользователя

Теперь дважды введите новый пароль, после каждого ввода пароля нажимаем Enter.

But what do you do if the root password must be modified or reset?

This article shows you how to change the root password for your Linux Mint 20 system via three different methods.

Note: To change the root password, you must have either the current root password, sudo privileges, or have physical access to the system. It is also recommended to save the new password(s) in a secure location to be accessed when needed.

In this article, we will cover how to:

  1. Change or reset root password as root user
  2. Change or reset root password as sudo user
  3. Change or reset root password using GRUB menu

It is worth mentioning that all the commands included in this article have been tested in the Linux Mint 20 system. These commands have been performed in the Terminal, which can be opened using the Ctrl+Alt+T key shortcut, or by clicking on the terminal icon present in the taskbar of the Linux system.

You will be prompted to enter a new root password. Type the new password and hit the Enter key. Then, re-enter the password and press the Enter key to avoid any typos.

After entering the password, you will be shown a message saying that the password has been updated successfully.

Change or Reset Root Password as Sudo User

After entering the password, you will be shown a message saying that the password has been updated successfully.

Дополнительно:  How to Root Samsung Galaxy S10 SM-G973F

Change or Reset Root Password Using GRUB Menu

Next, navigate to the Advanced options.

Then, to switch to the edit window, click ‘e’ on the keyboard.

“linux bootvmlinuz-5.4.0—generic ==\2d26aa-051e
ro quiet splash”

Replace ‘ro‘ with ‘rw’ in the above line and, at the end of the line, append ‘init=/bin/bash’. It should now look like this:

“linux bootvmlinuz-5.4.0—generic ==\
2d26aa-051e-4dbe-adb2-7fbb843f6581 rw quiet splash =bin”

Adding ‘rw’ and ‘init=/bin/bash’ in the above line basically tells the system to log in to bash with read/write privileges. Note that this configuration will only apply for the current boot, not for subsequent boots.

You will be prompted for the root password. Input the root password and press the Enter key. Then, retype the password and press Enter to avoid any typos.

After entering the password, you will then see a message stating that the new password has been updated.

That is all you need to do to change or reset the root password of your Linux Mint 20 system without the sudo or root login. It is good practice to change the password frequently after some time, especially if you think it has been compromised.

Conclusion

In this article, we have identified three different methods to modify or reset the root password on your system. You can opt for any method, based on the privileges you have. If you have the root password or sudo privileges, you can easily reset the root password using the simple ‘passwd’ command. Otherwise, you can use the GRUB menu to change the root password, but only if you have physical access to the system.

I hope this article has helped you in changing or resetting the root password of your system.

About the author

I am a self-motivated information technology professional with a passion for writing. I am a technical writer and love to write for all Linux flavors and Windows.

Edit Boot Grub Configuration

Next, locate the line that starts with ‘linux’. Navigate to the end of this line using arrow keys and just after ‘ro quiet’ append the line init=/bin/bash.

$ /# mount -n -o remount,rw /

Reboot Debian System

First, restart your Debian 11 system. As soon the GRUB menu appears, press the ‘e’ key on your keyboard on the first GRUB menu selection. This takes you to the GRUB settings.

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.

Check file system read and write access

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.

Debian 12 root password reset sucessfully
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
How to Reset Root Password in Debian 11 4

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
How to Reset Root Password in Debian 11 5
passwd username

passwd debian

How to Reset Root Password in Debian 11 6

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?

Reset Password

$ passwd

The system will ask you to set a new password. Type and retype the password to confirm. If everything is okay, you should get a message that says “password updated successfully”.

Karim Buzdar

Boot System to Single User Mode

First, forcefully reboot the system and press any key to stop the boot process when the below screen shows up on your system.

Press e to edit the kernel command line parameters.

Use the Down arrow key and go to the line that starts with the word linux. Then use the Right arrow or press the End key to go to the end of the line. Then, add init=/bin/bash.

After adding the entry, press Ctrl + x or F10 to boot the system.

mount -o remount,rw /
passwd

The reboot command will not work in this shell. So, press Ctrl + Alt + Del to reboot your system to boot into the normal mode.

Reset the password in single-user mode

# mount -o remount,rw /

Therefore, reset the root password by typing the command:

# passwd

Enter your preferred root password and confirm. While at it, ensure that you provide a strong root password to avoid easily falling victim of bruteforce or dictionary attacks.

Edit the GRUB menu settings

To get started, reboot your Debian system, and on the first boot entry as indicated below, press ‘e’ on the keyboard to access the GRUB editor.

You should be able to see a couple of lines on the editor like what we have here. Using your arrow down key, scroll down until you get to the line that begins with ‘linux’. Using the arrow forward key , navigate to the end of the line.

Be sure to delete the ‘ro quiet’ attributes.

Once deleted, enable access to the bash shell by typing init=/bin/bash

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.

Access Linux Grub Menu

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.

Edit Debian 11 Bullseye Grub menu

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:

Reset Root password in Debian 11 Buslleye

passwd username
passwd debian

Change Debian 11 user password

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.

Edit Grub Menu Debian 12

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.

Conclusion

That’s All. I hope you have learned how to reset forgotten root password on Debian 11.

Conclusion

Karim Buzdar

Оцените статью
Master Hi-technology
Добавить комментарий