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?

3 Answers 3


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.


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



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


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.


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.


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