Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Reset a Forgotten Password in Linux

Forgetting your password can be a frustrating experience, especially when it locks you out of your own system. In a Linux environment, resetting a forgotten password is a crucial skill that can save you time and effort. This article will guide you through the process of resetting a forgotten password in Linux, ensuring you can regain access to your system without having to reinstall the operating system.


Examples:


1. Using Single-User Mode (for most Linux distributions):



  • Step 1: Reboot your system. During the boot process, access the GRUB menu by pressing the Shift key (for BIOS systems) or the Esc key (for UEFI systems).

  • Step 2: In the GRUB menu, select the entry for your Linux system and press e to edit the boot parameters.

  • Step 3: Find the line that starts with linux and append single or init=/bin/bash at the end of this line.

  • Step 4: Press Ctrl + X or F10 to boot with the modified parameters. This will boot the system into single-user mode or a root shell.

  • Step 5: Once you have root access, you can reset the password using the passwd command. For example:
     passwd username

    Replace username with the actual username whose password you want to reset. Follow the prompts to enter and confirm the new password.


  • Step 6: After resetting the password, reboot the system using:
     reboot


2. Using a Live CD/USB:



  • Step 1: Boot your system using a Live CD/USB of your Linux distribution.

  • Step 2: Open a terminal and identify the root partition of your installed system using the fdisk -l or lsblk command. For example:
     lsblk

  • Step 3: Mount the root partition. Assuming the root partition is /dev/sda1, the command would be:
     sudo mount /dev/sda1 /mnt

  • Step 4: Change the root to the mounted partition:
     sudo chroot /mnt

  • Step 5: Reset the password using the passwd command:
     passwd username

    Replace username with the actual username.


  • Step 6: Exit the chroot environment and unmount the partition:
     exit
    sudo umount /mnt

  • Step 7: Reboot the system:
     sudo reboot


To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.