13

I need to authenticate so that I can use the VNC Server and Viewer and be able to access the Pi's screen from another computer. When I download the VNC Server I have to authenticate and enter a password for the username "pi" . The password is not "raspberry" and I do not remember if I changed it or not (i am a newbie to this). I have been working on a project for a long time and I don't wanna have to reset the whole pi. Is there a solution to reset the password or "find " it somewhere so that I can keep working? Thanks

0

2 Answers 2

10

to reset your password:

  • Power down and pull the SD card out from your Pi and put it into your computer.
  • Open the file 'cmdline.txt' and add 'init=/bin/sh' to the end. This will cause the machine to boot to single user mode.
  • Put the SD card back in the Pi and boot.
  • When the prompt comes up, type 'su' to log in as root (no password needed).
  • Type "passwd pi" and then follow the prompts to enter a new password.
  • Shut the machine down, then pull the card again and put the cmdline.txt file back the way it was by removing the 'init=/bin/sh' bit.

more information: https://web.archive.org/web/20160228052651/http://mapledyne.com/ideas/2015/8/4/reset-lost-admin-password-for-raspberry-pi

Hope this helps!

8
  • I tried it just now. But it doesn't work. The problem is that I am using Rpi3B+ with the newest Raspbian Version 2019April. I changed the cmdline.txt as instructed. However as usual, the system boots to GUI desktop. Anyway I go to terminal and typed su. Then I got the error message, not allowing me to log in. I guess Mapledyne's method does not work for Raspbian 2019April.
    – tlfong01
    Commented May 8, 2019 at 13:52
  • 2
    This is unnecessarily complex.
    – RalfFriedl
    Commented May 8, 2019 at 16:49
  • 3
    @tlfong01 It worked for me. But this link is better howtoraspberrypi.com/recover-password-raspberry-pi
    – xoani
    Commented May 9, 2019 at 9:04
  • 2
    Authentication token manipulation error ? Commented Mar 11, 2021 at 14:55
  • 1
    from @xoani 's link: adding mount -o remount, rw / before supplying passwd pi command can eliminate errors like "Authentication token manipulation error"
    – Mohit
    Commented Aug 24, 2022 at 17:48
15

The hashed password is stored in /etc/shadow. There is no efficient way to find out what the password is, by design.

However, it is easy to reset as long as you have physical access. Start a Linux on a computer. It can be an installed Linux or a Live Linux on a PC, or it can be a Linux on a PI. Find the line with the password of the PI in the /etc/shadow of an original SD card image. Mount your SD card, you may need an extra SD card reader for this. Replace the line with the password with the original value. You have reset the password to the original value.

3
  • Ah, no wonder I could not find /etc/shadow. So I need another linux on a Pi. I have have feeling that I am a head trying to catch the tail. I will study it again and try once more.
    – tlfong01
    Commented May 9, 2019 at 9:08
  • 26
    For anyone in need - this is the sha-512 hash for the default "raspberry" password: pi:$6$SBgOl43F$QTRz0W27/786iJiN5YLlrsce7g3taQv8TiQYfcfBTXmwPs.jw5lOzu2ciZwHSFTaw16R.UaAr6ZR.ZRO6lWDR1
    – php_nub_qq
    Commented Sep 29, 2021 at 7:58
  • Seems that this hash is not working with 2022-01-28 release of Raspberry Pi OS Commented Feb 7, 2022 at 12:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.