Learn how to recover a root password using recovery mode

In the Linux operating system, two types of users have access to authentication services or the same login password: one is a professional user and the other is a regular user. When you forget your login password, professional users can retrieve it for you through the terminal. What should users do if they forget their password? In answer to this question, we need to say that these people need to reset their password before starting the login page.

In this article, we will explain how to recover a root password using recovery mode. Note that this allows the malicious user (hacker) to gain physical control of the Linux host. Then join us to learn more about how to recover a root password using recovery mode.

What is recovery mode in Ubuntu?

If your operating system does not start normally, it is best to start it in recovery mode. This mode loads some basic functions and takes you to command line mode. Then log in as Root and you can customize your system using command line tools.

How to recover the password for Ubuntu?

Restart your system properly by pressing CTRL + ALT + DEL at the same time or using the Shutdown / Restart menu if the Ubuntu operating system is booting. When restarting, use the F11, 12F12, scEsc or Shift keys to open GRUB recovery mode. If you cannot access the recovery menu by pressing F11, press the F12 key instead.

Recover Ubuntu password from recovery mode

If you do not use the advanced Linux operating system for a long time, you may forget your login password. It is good to know that you do not need to reinstall the operating system to log in, and you can recover your system root password using the methods below.

Step 1: Enter recovery mode; Use the GRUB menu settings

If you have not already turned on your system, turn it on and press the Shift or ESC key before entering the Grub Menu page before the operating system boots. If it is on, restart the system using the key combination CTRL + ALT + DEL and follow the steps for it.

Note: If you are using Oracle VirtualBox or VMware, you must immediately hold down the Shift key when the Oracle or VMware logo appears. After entering the Grub menu, select Advanced Ubuntu Options.

Reset Ubuntu Root Password

Start the Ubuntu root password recovery mode

After this step, first the Recovery Mode option will be displayed quickly and then the black screen with several output lines.

Start the root password recovery mode

Start the Ubuntu root password recovery mode

Step 2: In the Shell command line recovery menu, select root

On the front page you will be presented with several options. Select the Root – Drop to root shell option using the Enter key.

Learn how to reset your password in Ubuntu

Enter the Ubuntu command line

Once selected, you will see a page with entered commands for the Linux command line environment. You will use these options to reset your system root password.

Step 3: Enable root access

The primary partition has read-only access by default. You can activate write access using the following command:

mount -rw -o remount /

Step 4: Reset your username and password

In this step, you will be granted root access and you can use the following command to display the list of users on your system:

ls /home

Using the following command, you need to select the password of which user you want to recover based on the existing list of users:

passwd username

The system will then ask you to enter your new password twice. Note that nothing appears on the screen when you start entering your password. This is one of the security features of Linux operating systems. Carefully enter the system password as shown below and press the Enter key:

Enter new UNIX password:
Retype new UNIX password:

Congratulations! You have successfully recovered your system password. Now it’s time to exit the Shell command line and enter the middle of the operating system:


Once logged out, you will return to the recovery page and simply select the normal boot option or reboot your system to log in to Linux with a new password.

Forgot password to reset Ubuntu

Restart the system and log in with the new password

Possible mistakes you may encounter!

When you try to enter a new password, you may encounter a possible error called authentication:

passwd username
Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token manipulation error
passwd: password unchanged

This error is due to the read-only partition. To resolve this error, simply enter the following command and grant access to the system:

mount -rw -o remount /

Now try to reset your system password again. No doubt this time the request will be made. As you can see, resetting the Ubuntu password is very simple and you can recover the root password in recovery mode in minutes.

An alternative way to recover a root password in Ubuntu

If for some reason you had problems logging in and recovering the password using the previous method and you cannot recover the system password with it, you can use the second method.

First stage

Restart the computer and hold down the Shift key to display the Grub screen (if it does not appear automatically). Press the E button on the Grub command prompt to gain editing access.

second stage

From the page options, find the line that starts with the word Linux, change the phrase ro to rw, and add init = / bin / bash at the end of that line. Then press ctrl-x to save the applied changes and enter.

You are now loading the Linux kernel with read and write permissions, and instead of going to the graphical user interface, you will use the bash shell. In fact, your system will boot into Shell’s root without a password.

Enter the passwd command with your username. If you do not know your username, get it using the ls / home command (as explained in the first method).

Enter the new password you want. Exit the terminal after setting the new password. In the terminal, simply enter reboot or use the shutdown command:

shutdown -r now

Your password must have changed with the settings provided.

Isn’t Ubuntu password recovery a security issue?

An important question for many Linux users is how to easily reset passwords and compromise security. One of the most important features of Linux operating systems compared to Windows is their incomparable security. However, if “anyone” can recover the password, how can Ubuntu or other Linux distributions be considered secure? One of the possible dangers arises when someone accesses your Linux host over the Internet and literally hacks it. If you have a physical system, you will avoid this danger.

Risk of physical hacking of Linux operating system by recovering root password

Your data will be compromised if someone physically accesses your operating system. Another important point is that if the whole drive is encrypted, anyone can steal your data even without logging in with USB.
What is the default Ubuntu password?

By default, the Ubuntu operating system does not have a root password and the root account is locked. Once you install Ubuntu as your operating system and account, you will be eligible for Sudo as your administrator; But that doesn’t mean you’re Ruth.

How do I find my Sudo password?

There is no default password for Sudo and the recovered password is the same password that was set when installing the Ubuntu operating system. The lack of a root password is an important feature; For this reason, the Advanced Ubuntu options in the boot menu allow you to perform some root-related tasks using the Root Shell Prompt.

This is the reason why it allows you to recover the password from root. If you want a more secure system, you can set the disk to encrypt (to store your data) or password for the root user of Ubuntu.


Recovering a root password using recovery mode is one of the most common ways to reset a Linux operating system password that you forgot for a variety of reasons. In this article we have presented two practical ways to recover a root password, making each of them, you can recover your forgotten password in minutes.

Frequently Asked Questions

1. Do we need to change the operating system by forgetting the Linux root password?

If you forget the password for the Linux operating system, you do not need to reinstall the operating system, and you can recover the root password of the system using several methods.

2. If an unauthorized person accesses our system, can he / she retrieve the information by resetting the password?

The answer to this question is unfortunately yes, although you can prevent hackers from accessing your information by encrypting the disk; But preventing security breaches by resetting the Linux root password is inevitable.

3. Which keys should we use to access the GRUB menu?

You can use the F11, F12, Esc or Shift keys to restart the GRUB recovery mode.

{“@context”: “https://schema.org”, “@type”: “FAQPage”, “mainEntity”: [{
“@type”: “Question”,
“name”: “آیا با فراموش کردن پسورد روت لینوکس باید سیستم‌عامل را عوض کنیم؟”,
“acceptedAnswer”: {
“@type”: “Answer”,
“text”: “درصورت فراموشی رمزعبور سیستم‌عامل لینوکس نیاز به نصب دوباره سیستم‌عامل نیست و می‌توانید از طریق چندین روش پسورد روت سیستم خود را بازیابی کنید.”
“@type”: “Question”,
“name”: “اگر شخص غیرمجازی به سیستم ما دسترسی پیدا کند می‌تواند با ریست‌کردن پسورد اطلاعات آن را در دست بگیرد؟”,
“acceptedAnswer”: {
“@type”: “Answer”,
“text”: “پاسخ این سوال متاسفانه بله است، اگرچه شما می‌توانید با رمزگذاری دیسک از دسترسی هکرها به اطلاعات خود جلوگیری کنید؛ اما جلوگیری از ایجاد نقض امنیتی از طریق ریست‌کردن پسورد روت لینوکس اجتناب‌ناپذیر است.”
“@type”: “Question”,
“name”: “برای دسترسی به منوی GRUB از کدام کلید‌ها باید استفاده کنیم؟”,
“acceptedAnswer”: {
“@type”: “Answer”,
“text”: “برای بازکردن حالت بازیابی GRUB می‌توانید از کلید‌های F11، F12، Esc یا Shift هنگام ریستارت استفاده کنید.”

Tutorial for recovering root password using recovery mode for the first time in Parsupak. appear.

Leave Your Comment

Your email address will not be published.

Supportscreen tag