0

I've been watching the raspberry pi web server tutorial from tinkernut and I think I've lost the default pi user, my ROOT password isn't working either. How can I recover the and regain access?

4

you may easily recreate any user by connecting your SD card to any linux computer where you have root access, then edit /etc/passwd, /etc/shadow and /etc/group files to add the corresponding line.

you may even use your RasPi for that purpose, provided you have another SD card to boot from and USB SD card reader to insert the broken one into the USB slot.

3

Connect the SD to a PC running Linux (even a LiveCD distribution - you don't need to install it on your hdd)

add

   pi:x:1000:1000:,,,:/home/pi:/bin/bash

to etc/passwd (not /etc of your Linux, but the root of the card, it may be /media/sdb/etc/passwd or something like this depending on your distribution) if it isn't there, or edit it to match the above if the line is already there.

add or replace

    pi:$6$G51puwbE$iT/ijeT8KDhgmYFTeKfQBbCox.xz6yj736aPe7q8CYEVUTNxqz.g4jlag8osuwChqRc2ReoKNVukibU2Xg0ol/:15912:0:99999:7:::

in etc/shadow correspondingly. This restores the user with the default password raspberry.

OTOH, if you did very little with the system, re-flashing the whole SD might be easier.

-1

If you can't remember the password then you'll have to re-install your OS. Do so by formatting the SD card then using a disk imager to install the OS. However you will lose all the files and installations previously on the Pi.

protected by Ghanima Dec 10 '16 at 18:00

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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