Change Password on Raspberry Pi

If you loaded your Raspberry Pi using the Raspbian operating system, chances are you may still be using the default user id “pi” with the password “raspberry”. This is a quick tutorial to show you how to change that.

You could change your password using raspi-config, the same utility used to configure Raspbian on the first boot. This is the easiest way to do it, and requires root privilege escalation with sudo.

The way that is common to all Linux distributions is to use “passwd”.

Login to your pi, type the following command to change your password.

The command will return with the following output:

Type in the current password that you are logging in with.

Type in the new password twice. This is quite effective at insuring you do not mistype your new password.

If the above steps were done correctly, you will receive this message.

To test the password change, logout or open a new ssh connection. If you are remote, keep your existing ssh connection open just in case you fat-fingered your password twice above.

Changing Another User’s Password

The passwd command is usually passed with an argument of the userid for which the password will be changed. When executing the command without the argument it naturally assume that it will change the password of the current logged in user as above.

The pi account by itself does not have administrative privileges without passing command using sudo. The sudo command allows a normal user to pass a command as if were root. Not every user on a system has this ability, but can be added in the /etc/sudoers file, which is a lesson for another time.

If there was another user on the system named “izzy” and we wanted to change that account’s password you would run the following command and progress through the prompts as we did before.

Successful completion will have changed izzy’s password.

2 Replies to “Change Password on Raspberry Pi”

Leave a Reply

Your email address will not be published.