How to Perform Password Resets in Linux [Step

choubertsprojects

VPN offers!

1. NordVPN

2. Surfshark

3. ExpressVPN

This article will teach you how to reset your Linux password from a terminal window. Ubuntu comes with the Command Prompt by default, and other Debian-based distributions have it as well. If you are using Gentoo or Arch, try this command:

The “how to reset root password in linux” is a step-by-step guide on how to perform password resets in Linux. The article also includes the commands needed to run and what they do.

How to Perform Password Resets in Linux [Step

Are you having trouble remembering your Linux user password? Have you forgotten the root account password? Don’t worry; if you forget or lose your password, you won’t have to reinstall the operating system. A single command line or a few steps may be used to rapidly reset a Linux password.

If you’re an IT specialist who’s having trouble resetting passwords in Active Directory, check out Specops’ uReset tool.

Continue reading, and by the Conclusion of this article, you’ll know how to reset your password, another user’s password, and even the root user’s password.

Let’s get this party started!

Prerequisites

This will be a hands-on presentation in this course. If you want to follow along, make sure you have the following items on hand:

  • A machine that runs on Linux — Although this guide utilizes Ubuntu 20.04 LTS, the same procedures may be followed with any other Linux system.
  • A user account that has sudo access.

Using the Terminal to Reset Your Linux Password

Password resets are no exception to the rule that most, if not all, administrative actions in Linux involve executing commands in the terminal.

Whether you’re updating your password, resetting another user’s password, or resetting a lost root account password, the terminal commands are consistent across Linux distributions.

This part assumes you’ve previously signed in to the Linux machine, either locally or remotely over SSH.

Setting up SSH in Linux (A Windows Guy in a Linux World)

Password Alteration

Follow the instructions below to change your user account password.

1. Type passwd into the terminal and press Enter to begin the password changing procedure.

2. Type your existing user password and hit Enter at the following screen.

If you don’t see what you write on the terminal, don’t worry. Normally, the terminal conceals or masks the password input with a * or another character.

3. Then, next to the New password prompt, type the new password and hit Enter.

4. Finally, validate the new password by retyping it and pressing Enter. If the new passwords are the same, the system will update the password, and you should see something like this.

Password reset for your user Password reset for your user

Password Reset for Another User

Multiple user accounts are frequent on Linux machines, particularly on servers. Other users may need a password reset from time to time. You may also reset the passwords of other users if you have sudo capabilities.

These instructions may also be used to reset the root account password.

1. Run the command below in the terminal to reset another user’s password. Make careful to adjust the username to the password reset’s target username. You want to execute the passwd command as a superuser if you use the sudo command.

The script below, for example, will update the password for the username victor.

2. Type your user account password into the box and hit Enter. By doing so, you’re confirming that you’ll be running the command as a superuser.

3. Press Enter after entering the new password for the user whose password you wish to change.

4. Retype the new password and press Enter to confirm. You should get news that the user’s password has been successfully modified if both passwords match.

Resetting another user's password Password Reset for Another User

You’ll have access to the user’s accounts until the individual changes their password, which may be a security risk. To force a password change on the next login attempt, you should instantly expire the user’s new password as a workaround.

5. Finally, execute the command below in the terminal to compel the user to change their password at their next login. The -e argument makes the new password expire immediately.

Password expiration for a user account Password expiration for a user account

6. Provide the user with a new (temporary) password and inform them that they will be forced to change their password at their next login.

Changing or Renewing a Group Password

A password may be assigned to a group in Linux. A user who is not a member of the group but knows the password may get temporary access to the group’s permissions. A group’s password is a shared password by definition, and a shared password may be hacked.

In such cases, you may change the password for the group. Follow these instructions to do so.

1. Type the command below into the terminal and hit Enter. Make sure to replace groupname with the name of the group for which you wish to reset the password. The gpasswd command is used to manage groups, including changing their passwords.

The program below, for example, changes the password for the support-group group.

support-group sudo gpasswd

2. Now put the new group password into the box and hit Enter.

3. Finally, hit Enter after retyping the new group password. The password for the group is then changed by the system. As you can see below, if the update was successful, there will be no confirmation notice and no errors.

Changing the password for a group Changing the password for a group

Resetting a Linux Password Outside of the Operating System

Real access to the Linux computer, whether physical or virtual, is required for the processes in this section.

Users can resolve issues in pre-OS modes on Linux distributions. These modes offer you immediate access to the root shell, allowing you to reset any user’s password, even the root’s.

The GRUB Menu appears when you boot up your computer.

For various Linux distributions, there are a variety of bootloaders available. GRUB is a bootloader., which is included in most Ubuntu-based Linux distributions, will be used in the following procedures. While the process may vary, the essential concept remains the same.

You must first boot your machine into the GRUB menu to obtain access to the root shell. Restart the machine to do this. Hold down the ESC or Shift key as the computer reboots until you get a screen similar to the one below.

GRUB is a bootloader. GRUB is a bootloader.

LILO Linux Bootloader: Understanding and Configuration

In Recovery Mode, resetting a password

Follow the instructions below to reset a password in recovery mode after you’ve accessed the GRUB boot menu.

If the root account has a password, the process in this section presupposes that you are aware of it.

1. Hit the down arrow on the GRUB menu once or until the Advanced options for Ubuntu option is highlighted, then press Enter.

Choosing Ubuntu's Advanced Options Choosing Ubuntu’s Advanced Options

2. Highlight Ubuntu, with Linux (recovery mode) on the following page and hit Enter.

Choosing the Ubuntu Recovery Mode Choosing the Ubuntu Recovery Mode

3. Select the root option from the Recovery Menu that appears and hit Enter.

Enter the root password at the prompt and hit Enter if the root account has one. If the root account does not have a password, enter the root shell prompt by pressing Enter.

The root shell prompt appears after booting up. The root shell prompt appears after booting up.

4. Despite having signed in to the root shell, you only have read-only access to the root partition at this moment. Before making any modifications, use the mount command to remount the file system in read-write mode.

5. Then, using the passwd username command, type in the new password twice, hitting Enter each time.

Resetting a user's password in recovery mode In recovery mode, resetting a user’s password

Run the passwd command without a username to reset the root password.

6. Type reboot -f and press Enter to leave recovery mode and reset the machine.

In Single-User Mode, Resetting a Password

If your Linux machine fails to start properly, you may set it to single-user mode (a.k.a., maintenance mode). The system allows you low-level access and limited functionality to the Linux computer in this mode, enabling you to troubleshoot.

Thankfully, the maintenance mode allows you to perform password reset operations. Also, even if the root account has a password, going into maintenance mode does not prompt for it. In other words, lost root passwords may be reset while in maintenance mode.

To execute a Linux password reset in maintenance mode, follow the procedures below.

1. Hit the arrow keys to highlight the Advanced settings for Ubuntu option on the GRUB screen, then press e to launch the editor.

The GRUB command editor is now open. The GRUB command editor is now open.

2. Once the editor is open, look for the line that begins with linux and ends with ro. The root partition will be read-only, as indicated by the ro suffix. To move the pointer, use the arrow keys.

Finding the entry that is read-only Finding the entry that is read-only

Users and File Permissions: A Windows Guy in a Linux World

3. Next, convert the ro to rw value. The root partition will be in read-write mode as a result of this.

As demonstrated in the screenshot below, move the cursor to the end of the file and insert init=/bin/bash. This command causes the machine to boot into the shell rather than the operating system environment.

Changing the read-write mount option on the root partition Changing the read-write mount option on the root partition

4. Press CTRL+X to boot the machine into the single-user mode root shell after modifying the boot commands.

5. Run the instructions to reset the password for the root user or any other users on the machine from the root shell.

Run the passwd username command to reset a user’s password, where username is the target user. After each prompt, enter the password twice more, hitting Enter each time.

In maintenance mode, resetting a user's password In maintenance mode, resetting a user’s password

Run passwd and input the root password twice, hitting Enter after each prompt to reset the root password.

Finally, restart the machine using the reboot -f command after changing the password(s).

If you’re an IT specialist who’s having trouble resetting passwords in Active Directory, check out Specops’ uReset tool.

Conclusion

If you forget your Linux password, you won’t lose access to the system permanently. You or someone else may execute a Linux password reset, which will allow you to regain access to the operating system.

Don’t panic the next time you fall into a password issue; be cool and use what you’ve learned in this lesson to reset a lost or forgotten password.

There are many ways to reset a password in Linux. The “unable to change user password in linux” is one such way.

Related Tags

  • reset linux password without old password
  • linux change user password without current
  • set password for user linux
  • how to reset root password in redhat linux 7
  • change user password ubuntu