Home FAQ How To Reset Sudo Password In Ubuntu 20.04 LTS
Reset Sudo Password In Ubuntu 20.04 LTS

How To Reset Sudo Password In Ubuntu 20.04 LTS

By sk
2937 Views

This brief guide explains how to reset sudo password in Ubuntu 20.04 LTS desktop or server editions. When installing Ubuntu for the first time, a new sudo user will be created to perform all sorts of administrative tasks. If you have more than one sudo users, you can easily reset the forgotten sudo user or administrative user password from another sudo user account. What If you have only one sudo user and you lost the password? No problem! It is very easy to recover forgotten sudo user password in Ubuntu. I tested this guide on Ubuntu 20.04 LTS server, however the steps given below are same for other Ubuntu versions and derivatives.

Reset Sudo Password In Ubuntu 20.04 LTS

We can reset the users' password from the "rescue" or "single user" mode. To reset a sudo user's password, first you need to ENTER into rescue mode. Refer the following guide to boot into rescue mode in Ubuntu-like systems.

After you entered in to the rescue mode, mount the root (/) file system in read/write mode by entering the following command:

# mount -n -o remount,rw /

Now, reset the sudo user's password using "passwd" command:

# passwd sk

Here, "sk" is the sudo user. Replace it with your own user name.

Enter the password twice:

New password:
Retype new password:
passwd: password updated successfully

Reset Sudo Password In Ubuntu 20.04 LTS

That's it. We have reset the sudo user password. If you have followed the Method 1 to enter into rescue mode as described in the above link, press “Ctrl+d” to boot into normal mode. Alternatively, you can type any one of the following commands to boot into normal mode.

systemctl default

Or,

exit

If you want to reboot the system instead of booting into normal mode, enter:

systemctl reboot

If you have followed the Method 2 to enter into rescue mode as described in the above link, type:

exit

You will go back to the recovery menu. Choose "Resume normal boot" and hit ENTER key.

Boot into normal mode in Ubuntu

Again, choose OK and press ENTER to continue booting into normal mode:

Booting into normal mode from rescue mode in Ubuntu

You can now use the new sudo password when running administrative commands.

What if I forgot both username and password?

If you forget the username, you can easily list the available users in your Linux system using command:

# cat /etc/passwd

Sample output from my Ubuntu 20.04 system:

[...]
sk:x:1000:1000:sk,,,:/home/sk:/bin/bash
[...]

Well, you now have the user name. Just follow the aforementioned steps to reset the user's password.


Suggested read:


Hope this helps.

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More