How to Change Password on Raspberry Pi OS (Complete Guide)


Until recently, all Raspberry Pi OS systems were installed with the same user and password (pi / raspberry). This is very convenient when you install it, but it can lead to security issues. Also, you may want to change your password regularly for security reasons. Here is how to do this.

On Raspberry Pi OS with Desktop, the password can be changed via the Raspberry Pi configuration tool, under Preferences in the main menu. On Raspberry Pi OS Lite or SSH, use the command “passwd”.

For more information, keep reading. I’ll explain the step-by-step process to change your password in each case. I’ll also provide a guide on what to do if you have lost your password.

If you need help getting started on Raspberry Pi, I have an entire course to guide you through your first steps. I’ll help you use the perfect hardware, plug everything in and install your first system. You’ll also do your first project with me, just to make sure you are ready for the next level. Get all the information on this page if you are interested.

Set the new password on Raspberry Pi OS

Download the Pi Glossary!
If you are lost in all these new words and abbreviations, request my free Raspberry Pi glossary here (PDF format)!

From 2012 to 2022, all Raspberry Pi models were pre-installed with the same username and password: pi / raspberry. Since April 2022, using a different username and password is now required on the first boot.

Welcome wizard on first boot

If you are using the latest Raspberry Pi OS version, you’ll get that kind of assistant showing up on your first boot:

After setting up your local settings, essentially your keyboard layout, you’ll get a new screen where you can create the first user:

Raspberry Pi Bootcamp
Sale: 10% off today.
Take it to the next level.
I'm here to help you get started on Raspberry Pi.
Learn all the skills you need in the correct order.

You’ll get something similar when you first start on Raspberry Pi OS Lite (without a desktop environment).

So basically, you can no longer avoid setting up a new username and password when you install Raspberry Pi OS. But if you want to change it later, or are using an older version of Raspberry Pi OS, I’ll explain how to change your password in the next parts.

Using Raspberry Pi imager

Another option if you want to skip this welcome assistant, is to use Raspberry Pi Imager, and especially the advanced settings, to set the new user and password directly on the SD card when you flash the new operating system.

To achieve this, click the wheel icon in the bottom-right corner of this tool once the system version chosen.

Then fill the form with at least the username, password and locale settings.

After using this, you should skip the first boot wizard, and get access directly to your desktop environment. This is particularly useful if you are installing new systems all the time, but let’s get back to your original question.

Change password on Raspberry Pi OS with Desktop

If you are on Raspberry Pi OS with Desktop, it should be pretty easy to change the password. I have included screenshots with the step-by-step guide below to help you with this procedure.
By the way, you absolutely need access to a session on Raspberry Pi OS to do this. If you have lost your password, check the last part of this tutorial before getting started below.

Welcome wizard

Before going further, I want to remind you that the welcome wizard on Raspberry Pi OS is a pretty neat tool that allows you to change many things, including the password for the “pi” user.

That’s almost the first question it will ask you:

If you are just installing your system, this is the easiest way to change your password. Follow this wizard, set a password, and configure the basic settings.

Raspberry Pi Configuration tool

There is a good chance you are here because you changed your password during the first boot, haven’t used your password since as the session opens without a password, and don’t remember what password you set.

No worries, you can change your password easily by following these few steps:

  • Open the main menu in the top left of your screen.
  • Go into Preferences and click on “Raspberry Pi configuration”.
  • A window will appear with many settings you can tweak.
    Click on “Change password”:
  • Then you can change your password directly:

    Choose a new password and enter it twice.
    If you are doing this for security reasons, I highly recommend using a long password (no need for multiple special characters, but long passwords are better).
    For example, I often use that kind of tool that generates long passwords that are easy to remember.
  • Once done, Raspberry Pi OS will display a success message:
Master your Raspberry Pi in 30 days
Sale: 10% off today.
Download the eBook.
Uncover the secrets of the Raspberry Pi in a 30 days challenge.
Learn useful Linux skills and practice multiples projects.

That’s it! You have now changed your password, and can proceed with whatever you were trying to do :).

By the way, if you are just getting started on Raspberry Pi, I can help you to learn much faster. My Raspberry Pi boot camp course helps you discover the Raspberry Pi device and unlock its secrets step-by-step. In a few hours, you’ll be ready to start any fantastic project you are interested in.

Change password on Raspberry Pi OS Lite (or SSH)

If you just have access to a terminal, via Raspberry Pi OS Lite or remote SSH access, you can’t use the previous tools.
But don’t worry, it’s not very complicated, as there is only one command to remember (and you have the choice).

Raspi-config

It’s not the fastest method, but it is definitely the easiest to remember.
Raspi-config is a great tool available on Raspberry Pi OS to configure most settings on your system.
It includes a function to change your password, which is what we will use in this section:

  • Open a terminal, connect via SSH or log in on Raspberry Pi OS Lite.
  • Start raspi-config with:
    sudo raspi-config
    Your current password might be required to go further. If you have lost it, check the last part of this guide.
  • Go to “System Options” (1).
  • Then click on “Password” (S3).
  • Confirm by pressing “Enter”.
  • Type your new password twice.
  • That’s it, you should get a confirmation message now:
  • You can exit raspi-config with “Esc”.

So, Raspi-config is pretty convenient to remember, but as I told you there is still a faster solution.

The passwd command

Raspi-config is just a nice interface, running many Linux commands in the background. If you remember this easy command, you can go directly to the last step.

The command line to change a password on Raspberry Pi is:
passwd

The good news is that this solution will work on any Linux distribution, even if you are not on Raspberry Pi OS.

Are you a bit lost in the Linux command line? Check this article first, for the most important commands to remember, and a free downloadable cheat sheet so you can have the commands at your fingertips.

Reminder: Remember that all my Patreon supporters get access to this website without ads, early access to my videos and much more. You can become part of this community for as little as $3 per month & get all the benefits immediately.

Recover access if you have lost your password

Get My Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!

We have discussed how to change your password if you still have access to the user session. But can you do the same if you have lost the password?
Yes, in fact, there are several solutions.

Use another user

The easiest way is to log in with another administrator user. If you followed my guide on how to create a new user on Raspberry Pi, you can use it to reset the password of another user.

Master Python on Raspberry Pi
Sale: 10% off today.
Get the eBook.
Do more with your Raspberry Pi, learn the useful concepts and take the shortcuts.
You miss half of the fun of using a Raspberry Pi if you don’t know anything about Python.

You need the sudo privileges to do this.
The command to change the user password from another session is:
sudo passwd <user>

So, for example:
sudo passwd pi

If you are logged in with another user, you can change it directly and recover access to this session.
Another option could be to change the default username on your Raspberry Pi.

Log in with root

A similar way is to use the root user directly.
If you have allowed it to access SSH, you can follow the same steps as with another user (you just don’t need sudo).

What you can also do, is removing the password requirement on another session. Here is the command to do this:
sudo passwd <user> -d
Once done, you can open a session with this user without any password, and change it following the first part of this tutorial.

As reminder, here is how to log in as root on Raspberry Pi.

Unfortunately, there is no other way. As the root user is not enabled by default, you can start in single user mode or anything like that, which I use on Linux from time to time.

Raspberry Pi Resources

Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.

Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Download the e-book.

VIP Community
If you just want to hang out with me and show your support, you can also join the Patreon community. I share behind-the-scenes content there and give you early access to my content. You’ll also get a shoutout when you join.
More details here.

Need help building something with Python?
Create, understand and improve any Python script for your Raspberry Pi.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now.

You can also find all my recommendations for tools and hardware on this page.


This tutorial doesn't work anymore? Report the issue here, so that I can update it!

0 0 votes
Article Rating

Patrick Fromaget

I'm the lead author and owner of RaspberryTips.com. My goal is to help you with your Raspberry Pi problems using detailed guides and tutorials. In real life, I'm a Linux system administrator with a web developer experience.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Recent Posts

Master your Raspberry Pi - 10% off