- A rejected password for no apparent reason is one of the most frustrating issues that one can have with a Raspberry Pi, especially if they are newbies.
- There are a few ways to get around this situation, and we're explaining how.
- You can find similarly useful articles in our Raspberry Pi errors dedicated section.
- Perhaps you also want to take a look at the Developer Tools Hub and bookmark it for easy access to all the updates.
Raspberry Pi is a great single-board computer, very compact, lightweight ad easy to use. But, like any other system, it has its drawbacks, namely a few frequent errors.
Among these, failure to recognize the password on the first boot or shortly after, as well as after ins. Sometimes, this happens at the first login: other times, after working fine with autologin for a while and the Pi asks again for credentials but won’t recognize the password.
If you happen to type it incorrectly, it will warn you. But if it fails to recognize it, it will just freeze
What to do if the Raspberry Pi password is not working?
- Insert the SD card with the OS image in another device
- The card should contain a file named cmdline.txt
- Open it in Notepad (or other .txt file reader)
- Edit the text to have init=/bin/sh at the end. It should look like this: dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=04ceb741-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait init=/bin/sh
- Save and exit > Insert the SD card into the Raspberry Pi
- When prompted type: mount -o remount, rw / (and repeat if an error message appears)
- Type passwd pi
- Insert a new password
- Then type sync
- Type exec /sbin/init
- Safe exit Raspberry Pi
Then put the card into the PC again and delete the init=/bin/sh combination you added. Save the changes and insert the card into the Raspberry Pi.
You should be able to use the new password.
2. Modify the password file for NOOBs
- Press Shift key while booting and the system will boot in the recovery mode
- Select your Raspbian image, and then click Edit config (e)
- Select the cmdline.txt tab and add the init=/bin/sh at the end as above
- Press OK and reboot
- When it stops, press Enter and where you see a line with #, type:
You should be able to log in with the new password. Then do the process backward, to delete the init=/bin/sh line.
How to change password after installing TightVNC server
Users sometimes encountered a login issue after installing a VNC server. The Pi boots, the user can log in via SSH, but then another login window pops up, where the Pi won’t accept the default credentials.
The tested solution is to go to the home directory, look for a file called .Xauthority and change the owner using the following command:
chown pi:pi /home/pi/.Xauthority
- Misspelling can oftentimes be the cause why the password gets rejected (like missing the p in raspberry)
- Linux is case-sensitive and only small letters should be used
- If you’re not using a qwerty keyboard, pay attention to the letters
- When typed, the password it is not visible on the screen (only appears as *******), so typos are again possible
We hope you found this guide helpful. If you did, or if you have any suggestions, don’t hesitate to use the comment section below.
FAQ: Read more about the RasperryPi password
- What is the default password for Raspberry Pi?
- How do I find my Raspberry Pi username and password?
With Raspbian, the default username is pi, and the password is raspberry. You should change them after the first login, using the raspi-config tool, or the graphical Raspberry Pi Configuration tool.
- How do I reset my Raspberry Pi password?
If you want to reset your password, you have to insert the SD card into a PC, look for a file cmdline.txt and edit if to contain init=/bin/sh at the end. Then insert the card into the Pi and, log in as root typing su, then passwd pi and follow the prompts to enter a new password.