Raspberry Pi OS Headless Setup

No Keyboard, Mouse, Display, HDMI or USB Converter is required for Raspberry Pi OS (Formally the Raspbian) Headless Setup!!

Raspberry Pi OS Headless Setup works on Raspberry Pi 3, Raspberry Pi 4, Raspberry Pi Pi Zero and Raspberry Pi Zero W


Years back, We had published a guide for setting up Raspbian Jessie on Raspberry Pi without Keyboard, Mouse and External Display. Today We are back with an another guide for Raspberry Pi 3Raspberry Pi Zero W and yes there is no need of any accessories like described earlier, which add up cost to our low budget Raspberry Pi setup. There are lot of guides available over the internet with label of “Headless” but most of them do not contain complete information required for successful headless setup. So let’s get started!!

Hardware Required:

Software Required:

Step By Step Procedure:

Step A – Downloading the required Software : 

  • Download and install SD Formatter from SD Association website.
  • Download and install Etcher from balena.io.
  • Download and install 7zip from 7-zip.org.
  • Download and install Notepad++ (Windows Notepad will also work).
  • Download latest version of Raspbian which is Stretch (Raspbian Stretch with Desktop / Raspbian Stretch Lite) from official Raspberry foundation website (Do not use Noobs Operating System).
  • Extract Raspbian Stretch image using 7zip.

Step B – Installing Raspbian OS on MircoSD Card:

  • Insert the MicroSD card into card reader and mount it on to USB port.
  • If you have old version of Raspian Jessie on to the card, just format the card using SD Formatter.
  • Run Etcher and select image extracted already from downloaded zip file.
  • Select SD Card drive.
  • Hit Flash button and wait few minutes.
  • On windows 10 various pop ups many emerge, just ignore them and wait until it will say Flash Complete!
  • SD Card may be unmounted automatically after flash process completes, unplug the SD card reader and plug it back.
  • Ignore all errors messages pop up after inserting the SD Card Reader back and go for step C.

Step C – Preparing SD Card for first boot (Headless):

    • Reinsertion of SD Card will create two more drives in My Computer section.
    • Ignore any errors or pop ups emerge (Do not format the drive this time as asked by Windows).
    • Open up the Drive with “boot” volume lable.
    • Create a new blank notepad file and save it in the boot drive as “ssh” without any extension in the end (See video for better understanding).
    • Creating “ssh” file will enable ssh access and We’ll be able to configure our Raspberry Pi Zero Remotely.
  • Create a new file in the same drive with name of “wpa_supplicant.conf” without any extension in the end and paste the following contents in there (Change SSID and Password according to your own network).

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


    • wpa_supplicant.conf file will be copied to /etc/wpa_supplicant/ directory on boot and our Pi will be connected to WiFi network automatically.
    • Change country as required
    • Without providing the country information, Raspberry Pi may not get connected to your WiFi network
  • Save the “wpa_supplicant.conf” file and remove Micro SD Card Reader.

Step D – Booting the Raspberry Pi:

  • Insert the card into Raspberry Pi and you are ready to go.
  • Watch our video tutorial for better understanding.
  • As your Raspberry Pi is directly connected to your WiFi Router, consult your Router’s manual to find out the IP address assigned to your Raspberry Pi.
  • For example, you can find out the IP address in TP-LINK router under DHCP > DHCP Client List.

Accessing Raspberry Pi via SSH using PuTTY:

PuTTY is an SSH and telnet client  widely used to access Raspberry Pi for installation and configuration of various applications remotely. Download 32 bit / 64 bit PuTTY installer and install PuTTY in your computer. Launch PuTTY and add IP address of Raspberry Pi under Host Name e.g. [email protected]  where pi  is the User Name. Click Open to initiate the connection. You will be asked for password to login to Raspberry Pi. Default password is raspberry.

You can save these credentials for future use to avoid typing the IP address each time you want to access Raspberry Pi. Just enter the details as described earlier, enter a name under Saved Sessions field and click on Save. To load these credentials, click the Saved Session name created earlier and hit Load.


Assigning Static IP address:

  • Open “dhcpcd.conf” file in Nano editor

sudo nano /etc/dhcpcd.conf

  • Scroll all the way to the bottom of the file and add one, or both of the following snippets. Depending on whether you want to set a static IP address for a wired connection (eth0) or a wireless connection (wlan0)

interface eth0
static ip_address=
static routers=
static domain_name_servers=

interface wlan0
static ip_address=
static routers=
static domain_name_servers=

  • Save the configuration file by pressing “Ctrl” and “X” key followed by “Y” and “Return” key

Important Note:

Hence, ssh is now enabled, it is recommended to change the default password. Adopt the few extra steps as following;

    • Open up a new ssh session using PuTTY
    • Type passwd  and press Enter key
    • Enter raspberry  which is assigned as default password to user pi
    • Enter new password of your choice and press Enter key
    • Confirm your new password by typing it once again and press Enter key
  • A new message passwd: password updated successfully  will confirm that you have successfully changed your default password for user pi.

Modify WiFi Credentials:

  • open “wpa_supplicant.conf” in nano editor

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

  • Add or change SSID and Password as desired


  • Save the configuration file by pressing “Ctrl” and “X” key followed by “Y” and “Return” key

Setup SSH Key Authentication / Login Raspberry Pi via SSH Key:

Are you tired of typing user name or password each time accessing your Raspberry Pi via ssh? Here is a solution with security benefits added up. In this setup we’ll use two kind of keys i.e. public & private to access our Raspberry Pi. Public key is stored (discussed under Server Side heading below) on Raspberry Pi and private key is used by PuTTY (Client Side) to authenticate the login.

PuTTY comes with another application named as PuTTY Key Generator. We’ll use it to generate our private & public keys. Launch the PuTTY Key Generator and hit the Generate button. Now it will ask you to move your mouse cursor on a grey-green rectangular area for generating randomness. Just move your cursor up and down, left and right over the rectangle until green bar fill the space up and soon it will end up creating our desired keys.

Server Side:

  • Login to Raspberry Pi using ssh using PuTTY and issue the commands below

mkdir .ssh/
nano .ssh/authorized_keys

  • The last command given above, will open a new file “authorized_keys” in nano editor
  • Open PuTTY Key Generator and copy the public key starts with “ssh” and paste it in nano editor using right mouse button
  • Save the file by pressing “Ctrl” and “X” key followed by “Y” and “Return” key
  • Submit the commands given below

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
chown $USER:$USER ~/.ssh -R
sudo nano /etc/ssh/sshd_config

  • Go down in “sshd_config” file and find line “AuthorizedKeysFile
  • Remove # in start of line with “AuthorizedKeysFile” word
  • Save the configuration file by pressing “Ctrl” and “X” key followed by “Y” and “Return” key
  • reboot your pi using sudo reboot  command

Client Side:

  • Open PuTTY Key Generator and hit “Save private key” to save the key file in an appropriate place in your pc
  • Open PuTTY and navigate to SSH > Auth
  • Click on browse under “Private key file for authentication” and select the the private key file store on your pc
  • Save the profile as discussed under second paragraph of Accessing Raspberry Pi via SSH using PuTTY
  • Click “Open” to launch the ssh session and you will not be asked for password again

MicroSD Card Life Saving Trick:

If you have spent enough time with Raspberry Pi then you may know that Micro SD Card gets corrupted too early which is related to number of writes your operating system made on to the MicroSD Card. Number of applications are writing to log file frequently and hence participate in major share in depleting write capacity. Log2Ram offers storing log data to RAM by mounting /var/log  into RAM which is stored in MicroSD card before safely shutting down the system. Follow the instructions below to install Log2Ram in to Raspberry Pi

  • Fetch the installation from GitHub repository

curl -Lo log2ram.tar.gz https://github.com/azlux/log2ram/archive/master.tar.gz
tar xf log2ram.tar.gz
cd log2ram-master

  • Giving execution rights to script

chmod +x install.sh

  • Run the install script

sudo ./install.sh

  • Remove the installation files

cd ..
rm -r log2ram-master

  • Reboot the Pi

sudo reboot

Disk Write Setting:

By default Log2Ram writes to the HardDisk every hour. If you think this is too much, you can make the write every day by moving the cron file to daily.

sudo mv /etc/cron.hourly/log2ram /etc/cron.daily/log2ram
sudo reboot

Install Successful:

After reboot, you can check if mount is successful or not

df -h


Setting the Date & Time Manually:


  • Cannot update the Raspberry Pi Operating system using sudo apt-get update ? or experiencing an error as given below?

 Release file for http://raspbian.raspberrypi.org/raspbian/dists/buster/InRelease is not valid yet (invalid for another 20d 21h 6min 9s). Updates for this repository will not be applied.

  • Are you fed up of time / date syncing of NTP and have no internet access?
  • Here is how we can update the time manually in our favourite Raspberry Pi.


  • Access the Raspberry Pi via SSH or open terminal in your Raspberry Pi Desktop
  • Type in sudo date -s ‘2020-06-16 13:30:10’ command
    • Where; Date is as following
      • Year: 2020
      • Month: 06 (June)
      • Date: 16
    • Time is in 24 hours format e.g.
      • Hour: 13
      • Minutes: 30
      • Seconds: 10
5 3 votes
Article Rating
Notify of
oldest most voted
Inline Feedbacks
View all comments
2 years ago


After installation it’s working fine using putty or vnc, but once I restarted it becomes unavailable.
Can you please help me accordingly?

2 years ago
Reply to  Irfaaan786

You have to enable ssh-server in raspi-config settings. Adding ssh file to the boot dir makes it awailable only on firs boot as far as I know.
sudo raspi-config
5) Interfacing options -> 2) SSH -> turn on
And one more thing to do on headless setup is to expand root filesystem from raspi-config.

Luca Danelon
Luca Danelon
2 years ago

how do you find the IP to connect to the raspberry?
I followed your guide and then I searched using advanced IP Scan and also using the methode of your other video https://hobbytronics.pk/accessing-raspberry-pi-on-first-boot-without-keyboard-mouse-and-display-directly-from-pc-using-ssh/ but I can’t find the IP of the Raspberry PI.
Are you sure that this methode work for the lastest version? I’m using the rasbian image of June 2018.

Colin Bull
Colin Bull
1 year ago

Many modern operating systems use a system to connect to device by local name. When you first ssh in use [email protected] as hostname in putty and this could save a lot of hassle

Would love your thoughts, please comment.x