Forgetting the root or user password on a Kali Linux machine can feel like hitting a brick wall, especially when you are in the middle of a critical penetration testing engagement or a certification exam like the OSCP. Because Kali is designed as a specialized offensive security distribution, it does not always behave like a standard Ubuntu or Debian desktop installation when it comes to recovery modes. Which means knowing how to reset password in Kali Linux is a fundamental survival skill for any security professional or student. This guide covers the most reliable methods, ranging from the standard GRUB single-user mode to advanced live boot techniques, ensuring you regain access without reinstalling the operating system.
Understanding the Kali Linux Authentication Structure
Before diving into the recovery procedures, it — worth paying attention to. Modern Kali Linux installations (2020.1 and later) default to a standard non-root user account created during installation, rather than the traditional root/toor default. The root account is typically locked by default, meaning it has no valid password hash in /etc/shadow But it adds up..
When you "reset the password," you are usually targeting one of two scenarios:
- Standard User Account: The daily driver account with
sudoprivileges. - Root Account: The superuser account, which may need unlocking and a password set for specific administrative tasks or legacy tool compatibility.
The method you choose depends heavily on whether you have physical access (or console access via hypervisor) and whether the disk is encrypted with LUKS Not complicated — just consistent. Surprisingly effective..
Method 1: Resetting via GRUB Single-User Mode (Standard Approach)
This is the fastest and most common method for bare-metal installations or virtual machines where you can interrupt the boot process. It requires access to the GRUB bootloader menu Took long enough..
Step-by-Step Procedure
- Reboot the System: Start or restart your Kali Linux machine.
- Access the GRUB Menu: Immediately after the BIOS/UEFI splash screen, hold down the Shift key (BIOS) or press Esc repeatedly (UEFI) to force the GRUB menu to appear. In VirtualBox or VMware, you may need to click inside the VM window quickly and press the key.
- Edit the Boot Entry: Use arrow keys to highlight the default Kali entry (usually the top one). Press
eto edit the boot parameters. - Locate the Kernel Line: Scroll down using arrow keys to find the line starting with
linuxorlinuxefi. It looks similar to:linux /boot/vmlinuz-6.x.x-kali-amd64 root=UUID=xxxx ro quiet splash - Modify Boot Parameters: Go to the end of that line. Add a space followed by:
rw init=/bin/bashrw: Mounts the root filesystem as read-write. This is critical; without it, the filesystem remains read-only, and you cannot write the new password hash to/etc/shadow.init=/bin/bash: Tells the kernel to launch a Bash shell immediately instead of the standardsystemdinit process, dropping you straight into a root shell.
- Boot into Single User Mode: Press
Ctrl + xorF10to boot with these modified parameters. - Verify Filesystem Write Access: You will land at a prompt like
root@kali:/#. Run the following command to ensure the root partition is mounted read-write:mount -o remount,rw / - Reset the Password:
- For a standard user (e.g.,
kali):passwd kali - For the root account (unlocks and sets password):
passwd root
- For a standard user (e.g.,
- SELinux/Relabeling (If Applicable): If you are running a hardened kernel or specific configurations, run:
touch /.autorelabel - Reboot: You cannot use the standard
rebootcommand becausesystemdisn't running. Use the kernel magic sysrq keys or force a reboot:
Alternatively, pressexec /sbin/initAlt + SysRq + b(may not work in all VMs) or simply hard reset the VM/Power button.
Method 2: Using a Kali Live USB (The "Chroot" Method)
If you cannot access GRUB (e.Now, g. , password-protected bootloader, UEFI secure boot complications, or corrupted GRUB config), booting from a Kali Live USB is the professional standard for recovery. This method works even if the target installation uses LUKS Full Disk Encryption, provided you know the decryption passphrase Nothing fancy..
Prerequisites
- A Kali Linux Live USB (same architecture/version as installed system recommended).
- Knowledge of the LUKS passphrase if encryption is used.
Procedure
- Boot from Live USB: Select "Live System" or "Graphical Live" from the boot menu. Do not select "Install" or "Graphical Install".
- Open Terminal: Once the live desktop loads, open a terminal.
- Identify Partitions: Run
lsblk -forfdisk -lto identify your target partitions.- Look for
crypto_LUKStype if encrypted. - Standard setup usually shows:
sda1(EFI),sda2(Boot),sda3(Root/LUKS).
- Look for
- Decrypt LUKS (If Encrypted):
The decrypted device will appear atcryptsetup luksOpen /dev/sda3 kali_crypt # Enter your LUKS passphrase when prompted/dev/mapper/kali_crypt. - Mount the Root Filesystem:
mount /dev/mapper/kali_crypt /mnt # If /boot is separate: mount /dev/sda2 /mnt/boot # If EFI is separate: mount /dev/sda1 /mnt/boot/efi - Bind Mount Virtual Filesystems: This prepares the environment for
chroot.mount --bind /dev /mnt/dev mount --bind /proc /mnt/proc mount --bind /sys /mnt/sys mount --bind /run /mnt/run - Chroot into the System:
Your prompt should change tochroot /mntroot@kali:/#, indicating you are now operating inside the installed system. - Reset the Password:
passwd kali # Or your username # Or for root: passwd root - Update Initramfs (Critical for LUKS): If you changed the root password and use LUKS, ensure the initramfs knows about the keyboard layout for the decryption prompt:
update-initramfs -u -k all - Exit and Reboot:
exit umount -R /mnt reboot
Method 3: Resetting via Recovery Mode (GRUB Menu Option)
Some Kali installations (especially those upgraded from older versions or installed via specific ISOs) present a "Advanced options for Kali GNU/Linux" submenu in GRUB containing a "