How to reset the root password on Ubuntu 20.04 if forgotten?

  • Your password should be 8 characters or more and contain a mix of letters (upper and lowercase), numbers and symbols.

Thanks for submitting a tip for review!

  • Пароль должен включать не менее 8 символов и содержать сочетание букв (прописных и строчных), цифр и символов.
  • Чтобы изменить пароль для другого пользователя, введите su, чтобы получить права суперпользователя, а затем введите passwd <имя пользователя>.

It’s a good idea to change your passwords regularly and consider using enterprise password management software.

This guide will help you change your Linux root password in Ubuntu or CentOS, or reset the password.

restart or change root password in linux
  • A computer running Linux
  • Command-line interface (terminal)

This article intends to provide a solution to reset the root password on Ubuntu 22.04. What if the password is forgotten?

The GRUB boot loader acts as an escape plan to switch to a new root password. GRUB (GRand Unified Boot Loader) boot loader starts up from the BIOS and leads up to load the installed operating system. The GRUB boot loader will be used to reset the root password.

Text, timeline Description automatically generated

Choose the first option “Ubuntu” and enter inside it using the “e” key to edit a few settings.

Text Description automatically generated

Replace the line “quiet splash $vt_handoff” to “init=/bin/bash“. Moreover, change the permission from “ro” to “rw” as well.

Text Description automatically generated

After that, press CTRL+X or F10 to boot with the above written settings.

A screenshot of a computer Description automatically generated with medium confidence

Upon successful execution of the command, you need to enter a new password. For confirmation, it will ask to enter the password again. After doing so, the password will be updated.

Содержание
  1. Conclusion
  2. How to Reset the Root Password on Debian 9 Stretch
  3. Installing and Configuring sudo
  4. Setting Root Password
  5. Changing Root Password
  6. Disabling Root Login
  7. Recovering Lost Root Password
  8. About the author
  9. Option 1: Changing Ubuntu Password in the Command Line
  10. Option 2: Change sudo Password with the passwd Command
  11. Option 3: Changing Ubuntu Password Using GUI
  12. Step 1: Reboot your Ubuntu 20.04 LTS Operating System and load the GRUB menu by holding the Shift Key on Keyboard
  13. Step 2: Press ‘e’ to edit the commands
  14. Step 3: Edit the clause of the second last line from ‘ro quiet splash $vt_handoff’ to ‘rw init=/bin/bash’
  15. Step 4: Press F10 or Ctrl-x to save the edits and boot
  16. Step 5: Type the command ‘mount | grep -w /’ to confirm the read and write access rights
  17. Step 6: Type the ‘passwd’ command and provide the new password for the root
  18. Step 7: Type the command ‘exec /sbin/init’ to reboot your Ubuntu 20.04 LTS Operating System
  19. Conclusion
  20. About the author
  21. Resetting a Root Password in Ubuntu
  22. Step 1: Boot to Recovery Mode
  23. Step 2: Drop Out to Root Shell
  24. Step 3: Remount the File System with Write-Permissions
  25. Step 4: Change the Password
  26. Changing the Root Password in CentOS
  27. Step 1: Access the Command Line (Terminal)
  28. Step 2: Change the Password
  29. Step 1: Access Boot Menu
  30. Step 2: Edit Boot Options
  31. Step 3: Remount the Drive
  32. Step 4: Changing the Password
  33. Step 5: Restart
  34. Об этой статье
  35. Reset Lost Linux Root Password from the Grub Menu
  36. Changing Your Root Password in Ubuntu
  37. Step 1: Open a Terminal Window
  38. Step 2: Change Your Root Password
  39. Сбрасываем пароль от root через GRUB
  40. Frequently Asked Questions
  41. 1. How does full disk encryption affect my ability to change my root password?
  42. 2. What is the difference between root and superuser password?
  43. 3. Can I create an expiration date for passwords?
  44. Reset Lost Root Password Using Live CD
  45. About This Article

Conclusion

ROOT-пользователь — это пользователь с правами администратора, созданный по умолчанию в Linux-системе (Ubuntu). Root аналог администратору в ОС Windows, который имеет доступ ко всему в системе.

Этот способ предполагает вход в систему Ubuntu под пользователем с sudo правами, а команда «su» разрешена как часть «sudo» привилегий.

sudo su

How to reset the root password on Ubuntu 20.04 if forgotten?

Глядя на скриншот выше, можно заметить смену пользователя на «root», таким образом, мы вошли в Ubuntu под root, используя свой пароль.

Теперь мы можем сменить пароль root-пользователя, для этого необходимо использовать следующую команду:

passwd

После ввода команды указываем новый пароль в запросе «New password» и повторяем новый пароль после запроса «Retype new password».

How to reset the root password on Ubuntu 20.04 if forgotten?

Пароль для root будет установлен при первом использовании команды или изменит его на новый пароль при дальнейших использованиях команды «passwd».

А работает ли новый пароль? Давайте это выясним, нажимаем сочетание клавиш «Ctrl+D», чтобы окончить текущий ввод данных в терминале, либо запускаем новый терминал и вводим новую команду:

su

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

How to reset the root password on Ubuntu 20.04 if forgotten?

Таким образом мы успешно изменили пароль от root.


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

How to reset the root password on Ubuntu 20.04 if forgotten?

Now type in your root password and press <Enter>.

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

The apt package repository cache should be updated.

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

It should be installed. In my case it is already installed.

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

The command should run as root as you can see from the screenshot below.

How to reset the root password on Ubuntu 20.04 if forgotten?

Setting Root Password

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

Now type in your desired root password and press <Enter>.

How to reset the root password on Ubuntu 20.04 if forgotten?

Now retype the root password and press <Enter>.

How to reset the root password on Ubuntu 20.04 if forgotten?

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

How to reset the root password on Ubuntu 20.04 if forgotten?

Changing Root Password

Now do the same things as you did on the Setting Root Password section of this article.

Disabling Root Login

How to reset the root password on Ubuntu 20.04 if forgotten?

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.

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

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.

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

remount,rw proc

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

Now type in your new root password and press <Enter> to continue.

Дополнительно:  Фатальные ошибки при сбросе смартфона к заводским настройкам

How to reset the root password on Ubuntu 20.04 if forgotten?

Now re-type your new root password and press <Enter> to continue.

How to reset the root password on Ubuntu 20.04 if forgotten?

You root password should be changed.

How to reset the root password on Ubuntu 20.04 if forgotten?

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.

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

This is how you reset your root password on Debian 9 Stretch. Thanks for reading this article.

About the author

Are you looking to change the root password in Ubuntu?

Changing passwords is a good practice and should be done periodically.

There are three (3) ways to change passwords in Ubuntu.

The first two (2) options use the command line, and the other uses Linux’s graphical interface (GUI).

  • Ubuntu installed and running
  • A user with sudo privileges
  • Access to a terminal/command line
  • The apt-get tool, pre-loaded in Ubuntu and other Debian-based distros

Option 1: Changing Ubuntu Password in the Command Line

To change the sudo password using the sudo command:

1. First, open the terminal using the keyboard shortcut CTRL+ALT+T.

2. Query for a password change by running the command:

sudo passwd root

You will be prompted to enter and verify a new password. The output will inform you the password was updated successfully.

example output after ubuntu changing root password
image of terminal to exit changes after password reset

Option 2: Change sudo Password with the passwd Command

1. First, open the terminal (CTRL+ALT+T).

sudo –i

Type in your current password and hit Enter. The output you receive should show that you can now run commands as root.

example command for sudo -l

3. Next, change the password by running the command:

passwd

Type and retype a new password to verify the change.

exit

5. Exit out of the terminal with the same command:

exit

Option 3: Changing Ubuntu Password Using GUI

To change the default root password in Ubuntu without using the terminal or any commands, use the graphical interface.

1. Open the Activities overview by pressing the Windows or Super key.

2. Type settings in the search bar and click on the Settings icon.

3. In Settings, click on the Details card (which is most likely the last one).

example of Ubuntu graphical interface with details selected

5. This will open a new Change Password pop-up. Type in your current root password, your new root password and verify the new password by retyping it.

6. Once you have filled in all the fields, click Change to confirm the changes.

change password prompt in ubuntu

Finally, make sure that your password includes both lower and upper case letters, numbers and special characters. It is essential to have a strong password to prevent brute force attacks.

This wikiHow teaches you how to change the Linux root password if you have the current password or if you don’t have access to the current root password.

  1. Image titled Change the Root Password in Linux Step 1

    • If you’re not using a desktop environment, you’re already at a command prompt, so proceed to the next step.
  2. Image titled Change the Root Password in Linux Step 2

  3. Image titled Change the Root Password in Linux Step 3

    • If you type the password incorrectly, run su and try again.
    • Passwords are case-sensitive.
  4. Image titled Change the Root Password in Linux Step 4

    Type passwd and press . An Enter new UNIX password: line will appear below the prompt.

  5. Image titled Change the Root Password in Linux Step 5

    Type a new password and press . The password you type will not appear on the screen.

  6. Image titled Change the Root Password in Linux Step 6

    Retype the new password and press . You will see a message that reads “password updated successfully.”

  7. Image titled Change the Root Password in Linux Step 7

    Type exit and press . This will log you out of the root account.

  1. Image titled Change the Root Password in Linux Step 8

    Restart your computer.

  2. Image titled Change the Root Password in Linux Step 9

    • If you don’t press before the Grub menu disappears, reboot and try again.
    • This method works for most popular Linux distributions (Ubuntu, CentOS 7, Debian). There are many distributions of Linux, some more obscure than others. If you’re not able to get to single-user mode with this method, check your distribution’s website for instructions specific to your system.
  3. Image titled Change the Root Password in Linux Step 10

    • In CentOS and some other distributions, the line may begin with linux16 rather than linux.
  4. Image titled Change the Root Password in Linux Step 11

  5. Image titled Change the Root Password in Linux Step 12

    Type init=/bin/bash after ro. The end of the line should now look like this:
    ro init=/bin/bash.

    • Note the space between ro and init=/bin/bash.
  6. Image titled Change the Root Password in Linux Step 13

  7. Image titled Change the Root Password in Linux Step 14

    Type mount –o remount,rw / at the prompt and press . This mounts the file system in read-write mode.

  8. Image titled Change the Root Password in Linux Step 15

  9. Image titled Change the Root Password in Linux Step 16

    Type a new root password and press . The characters you type won’t be displayed on the screen. This is normal.

  10. Image titled Change the Root Password in Linux Step 17

    Retype the new password and press . When the system confirms you’ve re-entered the same password, you’ll see a message that reads “password updated successfully.”

  11. Image titled Change the Root Password in Linux Step 18

    Type reboot –f and press . This command reboots the system normally.

Add New Question

  • How do I find the current password?

    77Ecrivan

    If you have lost your current root password, you may need to use a password cracking tool to get it back. Depending on the strength of the password you set, this could be either very easy or very difficult. John the Ripper is a popular password cracking tool that might work for you.

  • I am facing an authentication failure problem even after using a valid password. What can be the reason?

    77Ecrivan
  • I have tried this. The first time it works well, but not the second. I notice my linux line does not have the /boot/, can it still work?

    Haxalicious

    If your linux line does not have /boot/ and it does not boot up then you have broken your GRUB. You will need to re-add this line to boot your computer. If there is another path then just add the required things after «ro» on the linux line.

See more answers

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Из этой статьи вы узнаете, как в Linux изменить пароль суперпользователя, если вы знаете текущий пароль, и если вы его не знаете .

  1. Изображение с названием Change the Root Password in Linux Step 1

    • Если вы не пользуетесь средой рабочего стола, вы уже находитесь в терминале, поэтому перейдите к следующему шагу.
  2. Изображение с названием Change the Root Password in Linux Step 2

  3. Изображение с названием Change the Root Password in Linux Step 3

    Введите текущий пароль суперпользователя, а затем нажмите . Если введен верный пароль, вы получите права суперпользователя.

    • Если вы ввели неверный пароль, введите su и повторите попытку.
    • Пароли чувствительны к регистру.
  4. Изображение с названием Change the Root Password in Linux Step 4

    Введите passwd и нажмите . На новой строке появится Enter new UNIX password: (Введите новый пароль).

  5. Изображение с названием Change the Root Password in Linux Step 5

    Введите новый пароль и нажмите . Вводимый пароль не будет отображаться на экране.

  6. Изображение с названием Change the Root Password in Linux Step 6

    Введите новый пароль еще раз и нажмите . Вы увидите сообщение «Password updated successfully» (Пароль успешно обновлен).

  7. Изображение с названием Change the Root Password in Linux Step 7

    Введите exit и нажмите . Вы выйдете из аккаунта суперпользователя.

  1. Изображение с названием Change the Root Password in Linux Step 8

  2. Изображение с названием Change the Root Password in Linux Step 9

    • Если вы не успели нажать , и меню Grub исчезло с экрана, перезагрузите компьютер и попробуйте снова.
    • Этот метод работает в большинстве популярных дистрибутивов Linux (Ubuntu, CentOS 7, Debian). Существует много дистрибутивов Linux, и если у вас не получается перейти в однопользовательский режим с помощью этого метода, почитайте инструкции к своему дистрибутиву (на сайте его разработчиков).
  3. Изображение с названием Change the Root Password in Linux Step 10

    Перейдите к строке, которая начинается с linux/boot. Для этого используйте клавиши и . Эту строку нужно изменить, чтобы загрузиться в однопользовательском режиме.

    • В CentOS и некоторых других дистрибутивах нужная строка начинается с linux16, а не linux.
  4. Изображение с названием Change the Root Password in Linux Step 11

  5. Изображение с названием Change the Root Password in Linux Step 12

    Введите init=/bin/bash после ro. Конец строки должен выглядеть следующим образом:
    ro init=/bin/bash.

    • Обратите внимание на пробел между ro и init=/bin/bash.
  6. Изображение с названием Change the Root Password in Linux Step 13

    Нажмите . Это сообщит системе о том, что в однопользовательском режиме нужно сразу открыть терминал с правами суперпользователя.

  7. Изображение с названием Change the Root Password in Linux Step 14

    Введите mount –o remount,rw / в терминале и нажмите . Это приведет к монтированию файловой системы в режиме чтение/запись.

  8. Изображение с названием Change the Root Password in Linux Step 15

    Введите passwd в терминале и нажмите . Так как в однопользовательском режиме вы автоматически получаете права суперпользователя, нет необходимости добавлять в эту команду дополнительные параметры.

  9. Изображение с названием Change the Root Password in Linux Step 16

    Введите новый пароль суперпользователя и нажмите . Вводимый пароль не будет отображаться на экране.

  10. Изображение с названием Change the Root Password in Linux Step 17

    Введите новый пароль еще раз и нажмите . Когда система подтвердит, что оба пароля совпадают, вы увидите сообщение «Password updated successfully» (Пароль успешно обновлен).

  11. Изображение с названием Change the Root Password in Linux Step 18

    Введите reboot –f и нажмите . Эта команда перезагрузит систему в обычном режиме.

You have forgotten your root password, and now you have no idea how to retrieve your Ubuntu 20.04 LTS Operating System? In this post, we will guide you on how to reset your root password on Ubuntu 20.04 LTS System from the GRUB menu. The Grand Unified Bootloader or GNU GRUB menu is a boot loader and software or program that loads and transfers control to the Operating System like Linux-  it runs when a computer starts. So, let’s begin with the step-by-step guide of resetting the password of the root.

Step 1: Reboot your Ubuntu 20.04 LTS Operating System and load the GRUB menu by holding the Shift Key on Keyboard

The first step is to start your computer machine and keep pressing the shift button on your keyboard until the GRUB menu appears, as shown in the picture below:

How to reset the root password on Ubuntu 20.04 if forgotten?

Step 2: Press ‘e’ to edit the commands

Now, select the boot Operating system, which is Ubuntu in our case, and press the ‘e’ key on your keyboard to edit some commands. By doing so, we can load the root shell Command prompt. Pressing the ‘e’ key on your keyboard allows you to have an edit screen, as shown in the picture below:

How to reset the root password on Ubuntu 20.04 if forgotten?

Step 3: Edit the clause of the second last line from ‘ro quiet splash $vt_handoff’ to ‘rw init=/bin/bash’

After entering into the editing mode of commands, scroll down until the last, find a line that starts with the word ‘linux’ and change the last clause of this line that reads ‘ro quiet splash $vt_handoff’ to this clause, ‘rw init=/bin/bash’, as shown in the pictures below:

ro quiet splash $vt_handoff

How to reset the root password on Ubuntu 20.04 if forgotten?

How to reset the root password on Ubuntu 20.04 if forgotten?

Step 4: Press F10 or Ctrl-x to save the edits and boot

Once you have edited the line for loading the root shell command prompt, Press F10 or CTRL+X to save and boot the system. After the reboot, a shell command prompt screen of the root will appear, as shown in the picture below:

How to reset the root password on Ubuntu 20.04 if forgotten?

Step 5: Type the command ‘mount | grep -w /’ to confirm the read and write access rights

In the root shell command prompt screen, type the command given below for confirmation of the read and write privileges.

How to reset the root password on Ubuntu 20.04 if forgotten?

Step 6: Type the ‘passwd’ command and provide the new password for the root

Once read and write access rights are confirmed, type the ‘passwd’ command and enter or set the new password for the root.

How to reset the root password on Ubuntu 20.04 if forgotten?

You can see that the password is updated successfully.

Step 7: Type the command ‘exec /sbin/init’ to reboot your Ubuntu 20.04 LTS Operating System

After successfully updating the password of the root, the last step is to just reboot your system by typing the command given below:

After running the above command, your computer will reboot and load the welcome screen of the Ubuntu 20.04 LTS system.

Conclusion

The article contains a step-by-step and easy-to-understand guide on how to reset your forgotten root password on the Ubuntu 20.04 LTS system.

About the author

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.

Resetting a Root Password in Ubuntu

In some situations, you may need to access an account for which you’ve lost or forgotten a password.

Step 1: Boot to Recovery Mode

Restart your system. Once you see the splash screen for the computer manufacturer, hold down the shift key. The system should come up with a black and white GRUB, or boot menu, with different Linux kernel versions displayed.

Step 2: Drop Out to Root Shell

The system should display a menu with different boot options. Use the arrow keys to navigate to the option labeled root and press Enter.

The system should respond by giving you a command-line interface with a prompt.

Step 3: Remount the File System with Write-Permissions

Right now, your system only has read-only access to your system. That means it can look at the data, but cannot make any changes. But we need write-access to change the password, so we’ll need to remount the drive with the appropriate permissions.

At the prompt, type:

mount –o rw,remount /

Press Enter. This should allow you to make changes to the data on the hard drive.

Step 4: Change the Password

At the prompt, type:

passwd username
shutdown –r

Hit Enter, and your system should restart. Don’t press any keys, let the system come up to the login screen, and test to make sure the new password works.

Note: Learn how to use the chpasswd command. Chpasswd is helpful for managing multiple passwords and making multiple changes.

Changing the Root Password in CentOS

Changing a password in CentOS is almost identical to changing it in Ubuntu.

Step 1: Access the Command Line (Terminal)

Right-click the desktop, then left-click Open in Terminal.  Or, click Menu > Applications > Utilities > Terminal.

Step 2: Change the Password

sudo passwd root
change root password in centos

This is a similar process as in Ubuntu, with a couple of variations.

Step 1: Access Boot Menu

Restart the system, then tap the Esc key about once per second to launch the GRUB menu.

Step 2: Edit Boot Options

Use the arrows to highlight the version of Linux you boot into, then press e.

Use the arrows to highlight the line that starts with kernel or Linux.

Step 3: Remount the Drive

mount / -o remount,rw

Step 4: Changing the Password

passwd

Press Enter, and the system should prompt you to enter and confirm a new password.

Step 5: Restart

mount / -o remount,ro
sync
reboot

Your system should restart. Confirm that your new password works by logging in.

Note: If you ever come across a Linux boot failure, be sure to save our guide on using GRUB rescue to troubleshoot it.

It can be more challenging if you’ve lost or forgotten a password, but with a little creative restarting and editing, you shouldn’t find it too hard.

Об этой статье

Reset Lost Linux Root Password from the Grub Menu

1. First and foremost, to recover a lost root password, we need to restart the Linux host, assuming you forgot the password for root.

2. Once the GRUB page appears, quickly select the “*Advanced options for GNU/Linux” option by pressing the down arrow key and Enter button.

grub-advanced-options

3. Now press e to edit the commands.

You need to modify it or change it from “read-only” mode to “read-write” mode. Find the line beginning with “Linux.” Look for ro and change it to rw. Add init=/bin/bash at the end of the line.

grub-edit-kernel-loading-menu

4. Press F10. This will display a screen with a prompt.

grub-boot-bash-screen

5. Mount your root file system in read-write mode:

grub-bash-screen-reset-password

Once you are done, type:

This will exit the prompt and reboot the computer.

Changing Your Root Password in Ubuntu

Step 1: Open a Terminal Window

Right-click the desktop, then left-click Open in terminal.

Alternately, you can click Menu > Applications > Accessories > Terminal.

Step 2: Change Your Root Password

sudo passwd root

The system will prompt you to enter your password – this is the same password you use to log in to the system.

Next, the system will prompt you to enter a new password. Do so, and then re-enter it exactly the same when the system prompts you to retype the password. This double-entry confirms that you have typed the password correctly.

change root password in ubuntu terminal command

Сбрасываем пароль от root через GRUB

Существует еще один способ для изменения пароля от root или любого другого пользователя при загрузке Ubuntu.

Сначала перезагружаем наш ПК. Если меню GRUB не появляется автоматически, то удерживаем клавишу «Shift» во время загрузки. Это принудительно откроет меню GRUB.

How to reset the root password on Ubuntu 20.04 if forgotten?

Затем выбираем пункт «Ubuntu» в меню и нажмите клавишу «E», чтобы начать редактирование конфигурации загрузки.

How to reset the root password on Ubuntu 20.04 if forgotten?

Далее необходимо внести изменения в строку, заменяем значение:

quiet splash $vt_handoff
rw init=/bin/bash

Результат отображен на скриншоте ниже:

How to reset the root password on Ubuntu 20.04 if forgotten?

Изменения заключаются в том, чтобы из GUI перейти в оболочку Bash для внесения изменений — смена пароля. Нажимаем клавишу «F10», чтобы загрузиться с новой конфигурацией.

Загрузка с измененной конфигурацией сработает только один раз и сброситься при повторной загрузке.

How to reset the root password on Ubuntu 20.04 if forgotten?

Мы вошли в систему как root-пользователь в командной строке. Теперь используем команду для сброса пароля:

passwd

Указываем и повторяем новый пароль.

How to reset the root password on Ubuntu 20.04 if forgotten?

Затем перезагружаем систему в обычном режиме (без GRUB) и входим как root уже с новым паролем.

Frequently Asked Questions

1. How does full disk encryption affect my ability to change my root password?

Although encryption can complicate things when you’re trying to repair a problem on Linux, this is not the case when you’re trying to change the root password. You can still do it easily from grub as described above as long as you are able to gain access to the disk.

The only difference now is that outsiders won’t be able to just slide in and do the same themselves.

2. What is the difference between root and superuser password?

3. Can I create an expiration date for passwords?

Additionally, you could use the -w flag to set the number of days required for an advanced warning about the need to change the password . Typing passwd -w 7 root will send you warnings about changing the root password a week prior to the deadline you previously set with the -x flag.

Want to keep digging into Linux? We have a guide for setting up Bluetooth on Linux. You can also check out our list of tools to create your very own Linux distro!

Miguel Leiva-Gomez

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Reset Lost Root Password Using Live CD

If you have a Linux Live CD/USB, then you can boot into it and use it to reset the root password.

1. Download the latest version of Ubuntu, and create a bootable Live CD/USB from it. Boot your system from the removable drive as opposed to your hard drive.

2. On the display screen select “Try Ubuntu.” This will bring you to the Live CD desktop.

ubuntu-live-cd-try-ubuntu

In most cases it will be “/dev/sda1,” although it can differ depending on how your hard disk is partitioned.

  mntrecover
  devsda1  mntrecover
ubuntu-livecd-mount-partition

6. At this point we need to jail ourselves in the “mnt/recovery” directory. This means that we are pretending to be on the regular Linux filesystem. This is simply known as chrooting.

8. Once completed, exit from the chroot shell:

9. Unmount the root partition:

and exit your root:

10. Lastly, remove the Live CD and reboot into your Linux system.

About This Article

1. Type «su» and press Enter.
2. Enter the current password and press Enter.
3. Type «passwd ‘» and press Enter.

4. Confirm the new password and press Enter.
5. Type «exit» and press Enter.

Did this summary help you?

Thanks to all authors for creating a page that has been read 5,267,653 times.

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