0

I'm new to Raspbian.

I started the GUI for the first time (following a fresh install) using the instructions found here: How to set my Raspberry Pi to boot into the GUI? and the command:

sudo apt-get install lightdm

I rebooted the machine, but the default login (pi) and password (raspberry) no longer work. I don't know of any other way to reset the password.

Other than re-flashing the Raspbian image to the SD card, how can I get out of this situation?

0

1 Answer 1

2

Getting a terminal makes no difference. Also there you are ask for a username and a password. But you can reset the password if you can mount the ext4 root partition on another computer. Connect the SD Card with a card reader to a linux computer and mount the root partition to e.g. /mnt. Then edit

/mnt/etc/passwd

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

/mnt/etc/shadow

change
pi:ljrp9kgwknldgp80ooutqwwe06aswrjhgdhäthtltlehihifhiljlofwerndsl/RoIJcnHQ7kAzdXi3gN.Uw6kDFNLsJqtDZk0:17761:0:99999:7:::
to
pi::::

exact 4 colons are important.

Booting this in your RasPi you should be able to login without password: username pi, password just <enter>. If you want to do it on a terminal you can try the key combination <ctrl><alt><F1> when you are on the GUI. Most GUI switch with it to a terminal.

And yes, don't forget to give a new password.

3
  • Can you explain why my user and password are not working on the gui?
    – frepie
    Commented Sep 15, 2018 at 20:00
  • 2
    Any arbitrary password can be inserted into the /etc/shadow file if one uses the mkpasswd program to properly hash the password... mkpasswd -m sha-512 should produce a correctly hashed password. Commented Sep 15, 2018 at 20:39
  • @frepie No, I don't know why user an password are not working. I don't know what you have done. Normally with a fresh fläshed Raspbian you will boot into the GUI. There is no need to set it up with raspi-config and there is no need to install another display manager lightdm like you did.
    – Ingo
    Commented Sep 16, 2018 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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