VMware ESXi and vSphere Cluster Management
Change a Raspberry Pi User Password
Learn how to change a Raspberry Pi OS password with raspi-config or passwd, verify the update, and avoid common password and SSH problems.
Changing the password is one of the first security tasks to complete on a Raspberry Pi. A known or unchanged password creates an avoidable risk, especially when the device is connected to a home, school, work, or internet-facing network.
The account you use for normal administration may be a sudoer: a user allowed to run selected commands with administrator privileges. Its password helps protect access to elevated actions such as installing software, changing system settings, and managing other users.
Use a unique, memorable password that is sufficiently long and difficult for others to guess. Store it in a password manager or another secure location.
Understand the Raspberry Pi account you are changing
Raspberry Pi OS is the Linux operating system commonly used on Raspberry Pi computers. Older releases were called Raspbian.
Historically, Raspberry Pi OS installations commonly used a default account named pi with a publicly known initial password. Leaving that password unchanged was unsafe.
Current Raspberry Pi OS installations commonly ask you to create a username and password during first-boot setup. Therefore, do not assume that every modern installation has a pi account. The commands below normally apply to the account currently logged in, or to a named local account that you deliberately specify.
Choose a password-change method
Method 1: Change the password with raspi-config
raspi-config is Raspberry Pi OS's text-based system configuration utility. Open a terminal while signed in to the account whose password you want to change, then run:
sudo raspi-config- Enter your current password if
sudorequests it. The password is not displayed while you type. - Find the menu option for changing the current user's password. Its wording and position can vary between Raspberry Pi OS releases. It may be labelled something similar to Change User Password.
- Select the password-change option and follow the prompts.
- Enter the replacement password, then enter it again for confirmation. The input field may appear blank.
- After the utility reports that the password was updated, choose the option to finish or exit. You can also follow the on-screen instructions for returning to the terminal.
The change normally takes effect immediately. Restarting the Raspberry Pi is not required.
Method 2: Change the password with passwd
Change your own password
The passwd command changes the password for the currently signed-in user when no username is provided:
passwd- Enter the current password if the system requests it.
- At the new-password prompt, type the replacement password and press Enter.
- At the confirmation prompt, type the same password again and press Enter.
- Read the result. A successful update normally produces a message such as
passwd: password updated successfully.
Depending on account policy, the existing password may be requested before the new password. This is normally the preferred terminal method when changing your own password.
Set a password for another local account
An authorized administrator can use sudo with passwd and a username:
sudo passwd <username>Replace <username> with the actual local account name; do not type the angle brackets. For example, the historical pi account can be targeted only if that account really exists:
sudo passwd piThis administrator operation can set the target account's password without asking for that account's old password. It still requires an account authorized to use sudo, or another appropriate administrative identity.
What the password prompts mean
Verify the change before ending your session
A successful password update normally applies immediately and does not require a reboot. Test it in a new authentication session before closing the session that is currently working.
- For a graphical desktop, lock the screen and unlock it with the new password.
- For local terminal administration, open another terminal and test a command that requests authentication, such as an appropriate
sudocommand. - For SSH, keep the current connection open and try a separate SSH connection using the correct username and the new password. Close the original session only after the new connection succeeds.
SSH is a secure remote-login protocol often used to administer a Raspberry Pi from another computer. Future password-based SSH logins for the changed account require the new password. If SSH is configured for key-only authentication, a password test may fail even though the password was changed correctly; use the configured SSH key instead.
Password safety and recovery awareness
A password is a secret credential used to authenticate a user account. A user account is an identity used to sign in and own files and processes on the operating system. Do not share the new password unnecessarily, reuse it on other services, or leave it in an exposed note.
Store the password in a password manager or another secure storage method. Losing it can block ordinary local login, terminal authentication, desktop unlocking, and password-based remote access.
Changing a known password is different from recovering access after forgetting one. Recovery requires authorized local administrative steps and is a separate, security-sensitive procedure. Do not treat recovery instructions as part of the normal password-change process.
Troubleshooting
The password prompt appears not to accept typing
This is expected behavior. Linux hides password characters by design, so no characters, dots, or asterisks appear. Type carefully, press Enter, and type the password again when asked for confirmation.
The two password entries do not match
A typing error or a different keyboard layout may have produced different values. Repeat the process slowly and check the active keyboard layout if unexpected characters are being entered.
pi does not exist
A message such as “user pi does not exist” usually means the installation uses a custom account or a first-boot-created account. Run passwd for the currently logged-in user, or identify the correct local username before using sudo passwd <username>.
sudo rejects the password or permission
The current password may be incorrect, the account may not be a sudoer, or you may not be signed in to an administrative account. Retry with the correct password or use an authorized administrator account.
The new password is rejected as weak
The system's password-quality rules may reject a short, common, predictable, or reused password. Choose a longer and more unique password, optionally combining several memorable words with other characters where appropriate.
SSH login fails after the change
Check that you are using the new password and the correct username. Password authentication may also be disabled for SSH, in which case you must use the configured SSH key or another enabled authentication method.
The new password has been forgotten
Ordinary login may no longer be possible. Use only authorized local administrative recovery procedures, and treat account recovery as a separate task from changing a password you still know.