Raspberry Pi

How to Change Root Password on Raspberry Pi

A root user has the power to control the system completely. Multiple tasks require the user to enter as a root, so you must enter the Raspberry Pi system as a root user. If you have forgotten the root user password and want to change it, you can follow this article for guidance.

Change Root Password on Raspberry Pi

To change the root password on Raspberry Pi, go through the following steps:

Step 1: Open the Raspberry Pi terminal using “CTRL+ALT+T” and enter the following command to log in to root users on the terminal:

$ sudo -i

Alternatively, you can also use the following command to enter the Raspberry Pi as a root user.

The main difference between the above commands is that users have to use the “-i” command if the account is protected by a password, while they can use “su” without any protection.

Step 2: Now, through the following command, you can set the root password on Raspberry Pi:

passwd

Step 3: Write the “New password” for the root user.

Step 4: Add the same password again to confirm adding the new password successfully on the Raspberry Pi system.

Step 5: Once the password is set, run the “exit” command.

Optional: You can also use the following direct command in the terminal to change the root password for your Raspberry Pi system.

$ sudo passwd root

In this way, you can change the root password for Raspberry Pi if you don’t remember your previous password.

Conclusion

You can easily change the root password on Raspberry Pi by entering the Raspberry Pi terminal as a root user and running the “-i” or “su” command. After that, hit the “passwd root” command to confirm adding a new password for the root user. Alternatively, you can use the “passwd root” command to directly change the root password on the Raspberry Pi system without login into the Raspberry Pi system as a root user.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.