39

I am trying to log into my Raspberry Pi using PuTTY from Windows. However, whenever I try to log into my Raspberry Pi using the default username and password (pi* and raspberry) it says Access Denied.

I have the wpa_supplicant.conf file and ssh file created. This is its first bootup. I am using the latest version of the Raspbian Lite OS.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alan Shiah
  • 907
  • 1
  • 6
  • 19

5 Answers5

73

Recently, the default user setup of Raspbian was significantly changed, rendering most existing online tutorials invalid.

In essence, the default pi user no longer exists, so you have to create it and set its password using either the official Imager tool or by creating a userconf file in the boot partition of your microSD card, which should contain a single line of text: username:hashed-password, replacing username with the name of the user you want (e.g., pi) and hashed-password with the hash of the password you want.

According to the official guide, the easiest way to do this is by running the following in a terminal (Linux or macOS):

echo 'password' | openssl passwd -6 -stdin

Again, you should replace password with the password you want here.

Further reading: An update to Raspberry Pi OS Bullseye (2022-04-07)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
arctic_hen7
  • 1,344
  • 11
  • 13
  • 31
    Default `pi` and `raspberry`: `pi:$6$/4.VdYgDm7RJ0qM1$FwXCeQgDKkqrOU3RIRuDSKpauAbBvP11msq9X58c8Que2l1Dwq3vdJMgiZlQSbEXGaY5esVHGBNbCxKLVNqZW1` – André Kuhlmann May 20 '22 at 17:50
  • 15
    I can't believe their Official User Guide hasn't been updated... – MCMZL May 23 '22 at 20:27
  • 1
    Thanks @AndréKuhlmann I love you – nmu Jun 05 '22 at 12:58
  • 3
    @nmu you are welcome, but credit goes out to the following post: https://discourse.pi-hole.net/t/warning-latest-raspberry-pi-os-image-april-4th-2022/54778 – André Kuhlmann Jun 05 '22 at 14:45
  • Unfortunately for me Imager 1.7.3 either filled in the wrong hash for the password or did not generate the `firstboot.sh` at all. I had to go with the manual way of creating the `boot/userconf` file and populating it with `user:password_hash`. – Alex Burdusel Nov 06 '22 at 10:43
9

The default username and password are no longer valid for Raspberry Pi.

If you are trying to log in headlessly (without a monitor and keyboard), you can do it from Raspberry Pi Imager itself. On selecting the OS in Raspberry Pi Imager, you get an icon of settings in which you can

  • create a user
  • setup Wi-Fi
  • enable SSH

After configuring, you can continue flashing your memory card. And on first boot you will be good to go.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Decoy
  • 340
  • 1
  • 9
3

I have solved this problem. You can easily input your username and password with Raspberry Pi Imager.

Screenshot of an example of using "Advanced Options" in Raspberry Pi Imager

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
steven
  • 49
  • 1
2

A simpler solution only needs one step.

Create a file named userconf.txt with your PC / Mac, and drop it into your SD card root folder after you write the Raspberry Pi OS image system.

pi:/4g6TptuTP5B6

demo

enter image description here

test

# check ✅
$ cat /boot/userconf.txt
pi:/4g6TptuTP5B6

enter image description here

refs

https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-a-user

xgqfrms
  • 10,077
  • 1
  • 69
  • 68
1

add the user you created when flashing the image to the ssh group.

 usermod -a -G ssh YourPiUsername
nelasx
  • 191
  • 1
  • 2
  • 9