How to Reset Password in Linux

How to Reset Password in Linux: Step-by-Step Guide for Beginners

Have you forgotten a password for your Linux account? Don’t worry! Password resetting for beginners and pros alike ranging from the command line to GRUB recovery or even via Live USB is simple and straightforward on Linux systems. This complete guide will ensure by the end of the document you will know precisely how to reset a password in Linux effortlessly!

How to Reset Password in Linux ?

We all go through this at some point. Perhaps you have not logged into your Linux box for weeks, or you got a new system and don’t have the credentials to log in. Known to be highly secure, Linux does make it possible to reset a password while providing various options so as not to undermine system security.

Without further ado, let us explore them together in detail.

How to Reset Password in Linux


Method 1: While on Linux, Reset the Password Yourself (Where passwd Is the Command)

This is the easiest scenario. You’re logged in and want to reset your password (or an administrator needs to reset the password of another user). In this case, the passwd command does all the work for you. To do this, follow these steps:

  1. Start terminal.
  2. If you need a self-service Linux password change, type in this command:
    passwd
    • Remember to first authenticate yourself with the existing password.
    • After the verification step, you will be asked to enter the new password twice.
  3. If you’re using another password for an admin account:
    sudo passwd username
    • Replace username with the actual account’s name.
    • Type in your password to validate yourself as sudo. Then proceed to input a password for the user alongside confirmation of that password.

Reasons Why This Works:

With appropriate access, you can reset not only your Linux password but also those of other users. This is possible through the command:

passwd

which allows proper management of account password utilities.

Tip: Ensure the password you choose is reliable and distinct!

Read More : How to Share Text Between Android and Linux Easily : 6 Best Ways in 2025


Method 2: GRUB Recovery Mode

Perhaps you forgot the root password. While this might be more challenging, Linux allows you to change other passwords right from GRUB, also known as the system’s boot menu. Follow the steps below:

Step-by-Step Instructions:

  1. Restarting Your Device:
    Rebooting the system will allow you access to the GRUB menu.
    • In case the GRUB menu does not open by default, you can forcibly launch it by holding Shift or Esc, depending on the system.
  2. Access GRUB Menu:
    • Select your OS and press e to edit the settings.
  3. Change the Boot Options:
    Locate the line beginning with linux. Then append the following to the end of the line:
    init=/bin/bash
    • By doing this, you instruct the system to start with a bash shell running as root.
  4. Access the System Through Recovery Mode:
    Press the Ctrl + X keys or F10 for system booting. You will be welcomed by a terminal shell.
  5. Change the Mount of the File System From Read Only to Read and Write:
    The file system is mounted in read-only mode by default. To fix it, use:
    mount -o remount,rw /
  6. Assuming You Know the Root Password, Change It:
    Run the following command:
    passwd
    • Provide a strong password of your own choice for the root account to ensure heightened security.
  7. Exit the Environment:
    After changing the password, the final step is to restart the system by running:
    exec /sbin/init

The Reason Behind This:

Make sure you unlock the GRUB first because it disables the default login prompt until you enter recovery mode, allowing you direct command over the terminal shell.

Tip: To prevent unauthorized GRUB access, set a password for the bootloader.


Method 3: Live USB Approach

How to Reset Password in Linux

If you’ve lost access to GRUB recovery, using a Live USB method will provide easy access. All that is needed after setting up the USB is to boot into it, changing the password through a temporary Linux shell environment.

Step-by-Step Instructions

  1. Create a Live USB:
    Edit your USB using tools like Rufus (Windows), Balena Etcher, or UNetbootin to load Linux on a bootable USB.
  2. Boot Into Live Environment From the USB:
    Insert the USB, restart your system, and choose the bootable USB as the main boot device in the system BIOS.
  3. Locate the Root Directory:
    Get access to the terminal session in Live Linux. List mounted partitions by typing:
    fdisk -l
    • Find the Linux partitions labeled as /dev/sda1.
  4. Mount the Defined Linux System Root Partition:
    mount /dev/sda1 /mnt
  5. Enter the Root Environment for the Partition:
    chroot /mnt
  6. Reset the Password:
    Use the passwd command:
    passwd
    • Once the password is verified, control is provided back to the user.
  7. Restart the System:
    Shutdown and restart using:
    shutdown -r now


      • Unmount the partition and remove the Live USB:


    exit
    umount /mnt

This type of system access manages control over the filesystem, granting the user elevated privileges, without requiring a pre-existing level of access, making broad changes at the system level simple.

Tip: Keep a preloaded Live USB ready for precautionary measures in case of emergencies.


For Changes After Linux Passwords Come Under Reset:

  • Restrict Unauthorized Scope: Use strong, unique four-letter identifiers for each password. Ensure first two characters mix letters and numbers; do not repeat digits or exceed 12 characters.

How to Set a GRUB Password:

To lock down GRUB and prevent unauthorized recovery mode access, edit the file:

/etc/grub.d/40_custom

Set Up Multi-Factor Authentication:

Add MFA for enhanced security.

Check System Logs for Unauthorized Access:

For systems with multiple users, verify activity:

sudo cat /var/log/auth.log

Securely Store Admin Passwords:

Keep credentials safe in a secure offline location.


Frequently Asked Questions

1. How Can I Change My User Password Using a Linux Machine?

Run the passwd command from the terminal. To reset another user’s password, use:
sudo passwd username

2. What Do You Do If You Can’t Access GRUB?

Verify settings in BIOS or UEFI to ensure GRUB isn’t disabled. If needed, boot from Live USB as an alternative.

3. Is It Possible to Change the Root Password Without Using a Live USB or GRUB?

No. Either physical access or root-level access is required.

4. Is My Data Deleted If the Password Gets Changed?

No. Changing a password does not affect stored data.

5. How Do I Secure the System After a Password Reset in Linux?

Start with setting a strong password for GRUB, enable MFA, and audit system logs.

 


Conclusion Remarks

At some point, resetting a password on Linux will come up, but there is more than one way to complete this task. If you are a novice just needing to reset your password, or an administrator solving root access problems, Linux has got you covered.

Don’t forget that safeguarding your data involves more than just changing your password. Be sure to configure systems securely, keep backups, and block unauthorized access to sensitive areas. Staying proactive today can save a lot of headaches later!

Read More : How to Uninstall Firefox on Linux | A Step-by-step 2025 Guide

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *