Headless Setup

Once you have downloaded the OS img file from the foundation website, it will probabably be useful to add a couple of features to get your going straight away.

Inside the boot partition create a file called wpa_supplicant.conf.  Inside that file add the following

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Replace «ISO-two-letter-country-code» with your ISO Country Code (such as GBfor Great Britain), «your_SSID» with your wireless access point name and «your_PSK» with your wifi password.

Then in the same folder create a file called SSH to enable you to SSH to your pi.

Forgotten Raspberry Pi Password

I forgot the password for my Pi. This is the technique I found for resetting the pi user password.

Step 1 – Remove the SD Card

Remove the SD card from the Pi and insert it into your PC.

Step 2 – Edit cmdline.txt

In the boot partition there is a file named “cmdline.txt”. Edit this file in a text editor and add the following to the end of the existing text:


Make sure it is all one line!

Save the text file and eject the SD card from the PC.

Step 3 – Reset the Pi Password

Insert the card into the Pi with a monitor and keyboard connected. Power up the Pi. There may be a delay but you should be presented with a cursor.

At the prompt type the following command :

mount -o remount, rw /

You may see an error message.  Just enter the above command again.

/bin/sh: 0: can’t access tty; job control turned off [ 21.366191] random: crng init done

Enter the command to change the pi password

passwd pi

You will then be prompted for a new password. Enter it carefully and press the [Return] key. It will now ask you to retype the password.

Reset Lost Password

The password has been changed.

Now type the following commands :

exec /sbin/init

The Pi will continue to boot and return you to the normal command line prompt.

Log in to the pi with the new credentials

Shutdown the Pi and power it off.

sudo halt

Step 4 – Edit cmdline.txt

Remove the SD card from the Pi and using the PC edit the “cmdline.txt” file again and remove the “init=/bin/sh” text you added in Step 2.

Remove SD card from the PC and re-insert into the Pi.

Power up the Pi and login with your new password.