---
title: "Performing Linux Password Resets [Step-by-Step]"
description: "Lost the root account password? Don't lose hope yet! Learn how to perform Linux password resets inside the OS or in maintenance mode in this step-by-step tutorial."
canonical: "https://adamtheautomator.com/linux-password-reset/"
---

# Performing Linux Password Resets [Step-by-Step]

> Lost the root account password? Don't lose hope yet! Learn how to perform Linux password resets inside the OS or in maintenance mode in this step-by-step tutorial.

Source: https://adamtheautomator.com/linux-password-reset/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Performing Linux Password Resets \[Step-by-Step\]](https://adamtheautomator.com/wp-content/uploads/2021/10/How-to-Perform-Password-Resets-in-Linux-Step-by-Step.jpg)

# Performing Linux Password Resets \[Step-by-Step\]

[![](https://secure.gravatar.com/avatar/d05ab46ae71ee2393867f96cfec69e3a779ade5f81d9a519fc4d4fab1b177298?s=192&d=mm&r=g)Goodness Chris-Ugari](https://adamtheautomator.com/author/goodness-chris-ugari/)26 October 20216 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Linux](/tag/linux/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Performing a Linux Password Reset Using the Terminal](#performing-a-linux-password-reset-using-the-terminal)
*   [Changing Your Password](#changing-your-password)
*   [Resetting Another User’s Password](#resetting-another-users-password)
*   [Renewing a Group Password](#renewing-a-group-password)
*   [Performing a Linux Password Reset Outside the OS](#performing-a-linux-password-reset-outside-the-os)
*   [Booting to the GRUB Menu](#booting-to-the-grub-menu)
*   [Resetting a Password in Recovery Mode](#resetting-a-password-in-recovery-mode)
*   [Resetting a Password in Single-User Mode](#resetting-a-password-in-single-user-mode)
*   [Conclusion](#conclusion)

Did you forget your Linux user password? Or worse, have you lost the root account password? Don’t worry; you don’t have to reinstall the operating system because of a lost or forgotten password. You can execute a Linux password reset quickly with a single command line or only a few steps.

> _Stop struggling with password reset calls and account lockouts in Active Directory. [Get a FREE trial of Specops uReset.](https://specopssoft.com/contact-us/?utm_source=ata&utm_medium=referral&utm_campaign=na_ata&utm_content=mention)_

Keep reading, and by the end of this tutorial, you’ll have learned the techniques to reset your password, another user, or even the [root user](https://mediatemple.net/community/products/dv/204643890/an-introduction-to-the-root-user) password.

Let’s get started!

## Prerequisites

This tutorial will be a hands-on demonstration. If you’d like to follow along, be sure you have the following:

*   A Linux computer – This tutorial uses Ubuntu 20.04 LTS, but you can perform the same steps with any other Linux distribution.
*   A user account with [sudo](https://www.lifewire.com/) privileges.

## Performing a Linux Password Reset Using the Terminal

Most administrative tasks in Linux, if not all, requires running commands in the terminal, and password resets are no exception.

The terminal commands are standard among Linux distros, whether you’re changing your password, resetting another user’s password, or resetting a forgotten root account password.

> _The procedures in this section assume that you have already logged in to the Linux computer either locally or remotely via [SSH](https://adamtheautomator.com/ssh-command-in-linux/#Connecting_to_Linux_from_Windows)._

Related:[A Windows Guy in a Linux World: Setting up SSH in Linux](https://adamtheautomator.com/ssh-command-in-linux/)

### Changing Your Password

To change your user account password, follow the steps below.

1\. On the terminal, type [`passwd`](https://man7.org/linux/man-pages/man1/passwd.1.html) and press Enter to start the password change process.

2\. At the next prompt, type your current user password and press Enter.

> _Don’t worry if you don’t see what you type in on the terminal. Typically, the terminal hides the password input or masks the password with a_ `*` _or other character._

3\. Next, enter the new password next to the **New password** prompt and press Enter.

4\. Finally, retype the new password and press Enter to confirm. If the new passwords match, the system will change the password, and you should see an output similar to the one below.

![Resetting your user password](https://adamtheautomator.com/wp-content/uploads/2021/10/image-246.png)

Resetting your user password

### Resetting Another User’s Password

Having multiple user accounts on a Linux machine is common, especially on servers. And other users, from time to time, need their Linux password reset. If you have sudo privileges, you can reset other users’ passwords, too.

> _You can also apply these steps to reset the root account password._

1\. To reset another user’s password, run the command below in the terminal. Make sure to change the `username` to the target username of the password reset. The [`sudo`](https://man7.org/linux/man-pages/man8/sudo.8.html) command means that you want to run the `passwd` command that follows as a superuser.

```bash
sudo passwd username
```

For example, the command below will change the password for the username _victor_.

```bash
sudo passwd victor
```

2\. In the prompt, type in your user account password and press **Enter**. Doing so confirms that you are going to run the command as a superuser.

3\. Next, enter the new password for the user whose password you want to reset and press **Enter**.

4\. To confirm, retype the new password and press Enter. If both passwords match, you should get a notification that the user’s **password has been updated successfully**.

![Resetting another user's password ](https://adamtheautomator.com/wp-content/uploads/2021/10/image-247.png)

Resetting another user’s password

> _Until the user changes their password, you’ll have access to their user accounts — and this situation can be a security concern. As a workaround, you should immediately expire the user’s new password to force a password change on the next login attempt._

5\. Finally, to force the user to change their password during their next login, run the command below in the terminal. The `-e` parameter will immediately expire the new password.

```bash
sudo passwd victor -e 
```

![Expiring a user account password](https://adamtheautomator.com/wp-content/uploads/2021/10/image-248.png)

Expiring a user account password

6\. Give the user the new (temporary) password and advise of the force password change during their next login.

### Renewing a Group Password

In Linux, a [group](https://www.computerhope.com/jargon/g/group.htm) can have a password. A user who is not a group member but knows the group’s password can temporarily access that group’s permissions. By its nature, a group’s password is a shared password, and a shared password may become compromised.

In such situations, you can reset the group’s password. To do so, follow these steps.

1\. On the terminal, run the command below and press Enter. Make sure to change the `groupname` to the group’s name you want to reset the password. The [`gpasswd`](https://man7.org/linux/man-pages/man1/gpasswd.1.html) command allows administering groups, including changing a group’s password.

```bash
sudo gpasswd groupname
```

For example, the command below changes the password for the _support-group_ group.

```bash
sudo gpasswd support-group
```

2\. Now, type in the new group password and press **Enter**.

3\. Finally, retype the new group password and press **Enter**. The system then changes the group’s password. If the change were successful, you will get no confirmation message and no errors, as you can see below.

![Resetting a group password](https://adamtheautomator.com/wp-content/uploads/2021/10/image-249.png)

Resetting a group password

## Performing a Linux Password Reset Outside the OS

> _The procedures in this section require you to have physical access to the Linux computer, whether physical or virtual machine._

Linux distros have pre-OS modes where users can troubleshoot problems. These modes give you instant access to the root shell, giving you the power to reset the password of any user, including the root.

### Booting to the GRUB Menu

> _There are many different bootloaders available for various Linux distros. The following instructions will depict using the [GRUB](https://itsfoss.com/what-is-grub/) [bootloader](https://www.ionos.com/digitalguide/server/configuration/what-is-a-bootloader/), which you can find in mostly Ubuntu-based Linux distros. While the procedure may differ, the same general idea applies._

To gain access to the root shell, you first need to boot your computer into the GRUB menu. To do so, reboot the computer. While the computer is rebooting, hold down the `ESC` or `Shift` key until you see the screen similar to the image below.

![The GRUB bootloader](https://adamtheautomator.com/wp-content/uploads/2021/10/image-250.png)

The GRUB bootloader

Related:[Understanding and Configuring the LILO Linux Bootloader](https://adamtheautomator.com/lilo-linux/)

### Resetting a Password in Recovery Mode

Once you have entered into the GRUB boot menu, follow the steps below to reset a password in the recovery mode.

> _The procedure in this section assumes that you know the root account password if the root account has a password._

1\. On the GRUB menu, press the down arrow once or until you highlight the **Advanced options for Ubuntu** option and press Enter.

![Selecting Advanced options for Ubuntu](https://adamtheautomator.com/wp-content/uploads/2021/10/image-251.png)

Selecting Advanced options for Ubuntu

2\. On the next page, highlight the **Ubuntu, with Linux (recovery mode)** option and press **Enter**.

![Selecting Ubuntu Recovery Mode](https://adamtheautomator.com/wp-content/uploads/2021/10/image-252.png)

Selecting Ubuntu Recovery Mode

3\. On the **Recovery Menu** that follows, highlight the **root** option and press **Enter**.

If the root account has a password, enter the root password at the prompt and press **Enter**. If the root account does not have a password, press **Enter** to enter the root shell prompt.

![Booting into the root shell prompt](https://adamtheautomator.com/wp-content/uploads/2021/10/image-253.png)

Booting into the root shell prompt

4\. At this point, even though you have logged in to the root shell, you only have read-only access to the root partition. Before you can make any changes, remount the file system in read-write mode by running the [`mount`](https://linux.die.net/man/8/mount) command below.

```bash
mount -rw -o remount /
```

5\. Next, run the `passwd username` command and enter the new password twice, pressing **Enter** after each time.

![Resetting a user's password in recovery mode](https://adamtheautomator.com/wp-content/uploads/2021/10/image-254.png)

Resetting a user’s password in recovery mode

To reset the root password, run the `passwd` command without a username.

6\. To exit the recovery mode and reboot the computer, type `reboot -f`, and press **Enter**.

### Resetting a Password in Single-User Mode

If the Linux computer doesn’t boot normally, you can boot the computer to the [single-user mode](http://www.linfo.org/single_user_mode.html) (a.k.a., maintenance mode). In this mode, the system gives you low-level access and minimal functionality to the Linux machine allowing you to attempt troubleshooting.

Fortunately, the maintenance mode supports running password reset commands. Also, booting into maintenance mode does not ask for the root password, even if the root account has a password. Meaning, resetting forgotten root passwords is also possible inside the maintenance mode.

Follow the steps below to perform a Linux password reset in maintenance mode.

1\. On the GRUB screen, press the arrow keys to highlight the **Advanced options for Ubuntu** option and press `e` to open the editor.

![Opening the GRUB command editor](https://adamtheautomator.com/wp-content/uploads/2021/10/image-255.png)

Opening the GRUB command editor

2\. Once the editor is open, locate the line that starts with `linux` and contains the `ro` entry. `ro` means that the root partition will be read-only. Use your arrow keys to move the cursor.

![Locating the read-only entry](https://adamtheautomator.com/wp-content/uploads/2021/10/image-256.png)

Locating the read-only entry

Related:[A Windows Guy in a Linux World: Users and File Permission](https://adamtheautomator.com/linux-file-permissions/)

3\. Next, change the value from `ro` to `rw`. Doing so ensures that the root partition will be in read-write mode.

Move the cursor to the end of the file and append **`init=/bin/bash`,** as shown in the image below. This added command makes the computer boot directly into the shell instead of the operating system environment.

![Changing the root partition mount option to read-write](https://adamtheautomator.com/wp-content/uploads/2021/10/image-257.png)

Changing the root partition mount option to read-write

4\. After editing the boot commands, press `CTRL+X` to boot the computer into the single-user mode root shell.

5\. On the root shell, run the commands to reset the password root user or any other users on the computer.

To reset a user’s password, run the `passwd username` command where `username` is the target user. Enter the password twice, pressing **Enter** after each prompt.

![Resetting a user password in maintenance mode](https://adamtheautomator.com/wp-content/uploads/2021/10/image-258.png)

Resetting a user password in maintenance mode

To reset the root password, run `passwd` and enter the password twice, pressing **Enter** after each prompt.

Finally, after changing the password(s), restart the computer by running the `reboot -f` command.

> _Reduce service desk calls & update cache credentials for remote users even off VPN with a self-service password reset solution. [Get a Demo of Specops uReset!](https://specopssoft.com/contact-us/?utm_source=ata&utm_medium=referral&utm_campaign=na_ata&utm_content=mention)_

## Conclusion

Losing your Linux password does not necessarily mean losing access to the system forever. You or someone else can perform a Linux password reset and ultimately let you back into the OS.

The next time you get into a password snafu, don’t fret, keep calm, and apply the knowledge you have gained in this tutorial to reset a lost or forgotten password.

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Flinux-password-reset%2F&text=Performing%20Linux%20Password%20Resets%20%5BStep-by-Step%5D)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Flinux-password-reset%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Flinux-password-reset%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2022/09/Practical-Linux-Unix-Tee-Commands-for-the-Linux-Admin.jpg)

### [Master Unix tee Commands for Real-World Linux Admin Tasks](/unix-tee/)

Simplify Linux output management and streamline your workflow with the “Unix tee” command. This tutorial guides you through its practical applications.

![](https://adamtheautomator.com/wp-content/uploads/2024/03/openldap-4.jpg)

### [How to Install and Configure an OpenLDAP Ubuntu Server](/openldap/)

Unlock the power of OpenLDAP on Ubuntu for centralized user authentication, seamless access control management, and enhanced directory services!

![](https://adamtheautomator.com/wp-content/uploads/2024/03/pipe-command-in-linux-1.jpg)

### [Unleashing the Power of the Pipe Command in Linux](/pipe-command-in-linux/)

Unlock the prowess of the pipe command in Linux to streamline tasks, boost productivity, and simplify complex operations effortlessly!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
