How to use Raspberrypi headless

Raspberrypi's are the new credit sized computers. But what if you don't have a monitor or keyboard? Don't worry! Today I'm gonna guide you how you can still use it.

Go to raspberrypi's official website and download the raspbian image. Lite image will work. Once you're done downloading, just write the image to SD card. If you're a windows user, use some tools available on internet. If you have got a linux then use this command to write it. Assuming your SD card is showing as /dev/sdb, the command will be,

# unzip -p 'path to the zip file' | dd of=/dev/sdb bs=8M status=progress

Once this command is executed, just check the lsblk and confirm that you have got two partitions in your SD card. Assuming you have /dev/sdb1 as boot partition. Mount it at some mount point in your linux box. And create an empty file named 'ssh'.

# mount /dev/sdb1 /tmp
# touch /tmp/ssh

Well done. Now it will enable ssh daemon on start. Just insert the SD card into pi, insert ethernet cable and ssh into it with default credentials. Default username is pi and password raspberrypi.

$ ssh pi@'ip of your pi' # You can check it via your router settings page.

What if you don't have an ethernet connection?

No ethernet? Well, I have got you covered here too. Just insert the SD card in some card reader and mount the main partition where system is installed. Most likely it will be /dev/sdx2. In our example we had it /dev/sdb so assuming system is installed in /dev/sdb2. If you previously mounted /dev/sdb1 at /tmp, unmount it and mount the system there. Or mount it at some other mount point.

# mount /dev/sdb2 /tmp
# wpa_passphrase "SSID" "passphrase" >> /tmp/etc/wpa_supplicant/wpa_supplicant.conf           # replace SSID with your wifi ssid and passphrase with your passphrase.

That’s it. Now you will be able to use wifi once the pi starts. Contact if you have some problems while using/configuring/connecting to it.