Reset Raspberry Pi 4 Password without Login

, ,

If you forget your user password on your Ubuntu or Raspberry Pi OS, don’t worry. You can reset your password without having to login quickly and easily. This article will walk you through several ways for changing the root password on your PC. Note, these methods may also be applicable to other Linux distributions.

The method mentioned here works for resetting an Ubuntu password in VMware, dual boot or single install. All you need is a little bit of patience and to run a couple of commands. You’ll be able to reset the root password within minutes.


Ubuntu Password Reset from Recovery Mode

Step 1: Boot into recovery mode

Turn on your PC and go to the Grub menu. This menu appears automatically – if not, then hold down the “Shift” key or press the “Esc” key until the boot menu appears.

If you’re using Oracle VirtualBox or VMware, you have to hold down the shift key when the logo of Oracle or VMware appears.

In the grub menu, select the “Advanced Options for Ubuntu” you should see an option to go into “(recovery mode)“. Select it and it will bring you to a black screen with several lines of output. Wait for a few seconds here.

Step 2: Drop to root shell prompt

Now you’ll be presented with different options for recovery mode. Here you need to choose “Root – Drop to root shell prompt“. Just press the enter key to select this option.

You’ll see that when you select the root shell prompt option, an option to enter commands appears at the bottom. This is your root shell prompt and this is where you’ll use the commands to reset the password.

Step 3: Remount the root with write access

You need to have write access to the root partition. By default, it has read-only access.

Use the command below to remount it with write access:

mount -rw -o remount /

Step 4: Reset username or password

Here, you’ll be given root access. Use the following command to list all the users available:

ls /home

Based on this command, choose the “username” for which you want to reset or (say) hack the password. Now, use the following command to reset the password for the selected username:

passwd username

It prompts you for a new password. Enter the new password twice, that’s it. You have just successfully reset the password. Now exit the root shell prompt. When you exit, you’ll be back at the recovery mode menu. Select the normal boot option here. There will be a warning about graphics mode compatibility. Don’t worry, a complete reboot will fix that.

You should now be able to log in with the new password.

Alternate Method to Reset Ubuntu Password

If for some reason you have difficulty dropping to the root shell and changing the password, you can try these steps.

Step 1. Reboot your computer. Hold shift to bring up the grub screen (if it doesn’t appear automatically). Press E at the grub prompt to edit the grub screen.

Step 2. Find the line starting with linux, change the ro to rw and append init=/bin/bash at the end of that line. This can also be used to fix a frozen boot issue with Ubuntu Linux.

Step 3. Press CTRL-X to save your changes and boot. Now you are booting into the Linux kernel with read and write permissions, and instead of going to a graphical user interface, you’ll use the bash shell. In other words, your system will boot up to a passwordless root shell.

Step 4. Type in the passwd command followed by your username. If you don’t know the username, check with ls /home command. Set your new password and exit the terminal. Just type reboot in the terminal or use the shutdown command below.

shutdown -r now

Your password should be changed now.

If resetting Ubuntu passwords are this easy, why isn’t this considered a security risk?

One of the main advantages of Linux over Windows is its security. But if anyone can reset the password, how come Ubuntu or other Linux distributions can be considered secure?

The main security risk is if someone hacks into your account from a remote anonymous location via the internet. That’s not what is happening here.

If anyone has physical access to your computer, the data in your computer is already at risk. Unless the entire disk is encrypted, anyone can “steal” your data using a live USB without even entering your installed operating system.

By default, Ubuntu doesn’t have a root password and the root account is locked. The user account you set up while installing Ubuntu is included as an admin with sudo rights. But that doesn’t mean that you are root.

This lack of root password is a deliberate feature, the “advanced options for Ubuntu” in the boot menu allow you to perform some specific root-related tasks from the “root shell prompt”. This is why you’re able to reset the Ubuntu password through this method.

If you want to make your system more secure, you can either encrypt the disk or setup a password for root user in Ubuntu.



I welcome your thoughts, questions or suggestions on my article on resetting a Raspberry Pi 4 password without login.

You may support my work by sending me a tip using your Brave browser or by sending me a one time donation using your credit card.

Let me know if you found any errors within my article or if I may further assist you by answering any additional questions you may have.