Run Raspberry pi in a truely headless mode

Jul 3, 2018 · 7 min read

Say, I just bought a raspberry pi and wish to checkout how it works. But all I have is my Laptop, the Pi, a micro SD card and my wifi network. How do I connect and control the Pi?

Here is the story of how Nick became the headless nick

Update: Now you can remote control Pi graphically through the internet easily, added steps to do that.

1 — Download Raspbian

Your Pi needs an OS. Download Raspbian from ‘s download section:

2 — Flash it onto an SD card

You need to flash this downloaded image to the micro SD card. Assuming your laptop has a SD card slot, you need a flashing software like etcher. Go ahead and download from:

3—Configure WiFi

Its easier to make two devices talk to each other if they are in the same network. An ethernet cable can easily make your laptop’s network available to the Pi. But we don’t have one. So we are going to add a file to the SD card so that the Pi boots with a wifi pre-configured.

The SD card mounts as two volumes and . Open the volume and create a file named On booting the RPi, this file will be copied to directory in partition. The copied file tells the Pi the WiFi setup information. This would overwrite any existing wifi configuration, so if you had already configured wifi on the pi, then that will be overwritten.

A typical file is as follows

Your SSID is your wifi’s name. To find out SSID on ubuntu, you can use the command. The psk is the wifi password and your country code can be found here:

so replace all the fields in the above text

4 — Enable SSH

We will later access the Pi using a secured shell (SSH), SSH is disabled by default in raspbian. To enable SSH, create a file named in the partition. If you are on linux, use the command to do that.

5 — Find Pi’s ipaddress

Before switching on your raspberry pi, we need to findout the existing devices connected to the network. Make sure your laptop is connected to the same wifi network as the one you configured on pi above.

Run the command to find out your laptops’ ipaddress. Say it is then when connected your pi’s ip would be

Run the command to findout existing devices in the network in range 0 to 24 for the last portion of ipaddress. I get

Remove the micro SD card from your laptop and insert it into Pi. Power it up using a power source (5v regular android charger) and try again, to see which ipaddress newly appears

so should be the ip address of the pi.

6— SSH into the Pi

To create a secured shell connection, in linux we can use the command. If you are on windows, try downloading PuttY from

To connect to Pi you need the default username and password of the device. On first boot, the username and password would be as follows.

username :

now you can do

Type in when asked if you sure to continue connecting with the device. Then when asked for password, type in the pass.

You should now be inside Pi’s SSH. Smile :) we should savour such small victories

7— Change default password

Its a good practice to change the password to something else. You can use the command to do that.

8 — See the screen

Sometimes it doesn’t feel right if we can’t use the mouse. For that we need to look into the Raspbian desktop.

We need to setup VNC (Virtual Network Connection) to see and control Pi graphically. Let’s do that.

These commands would update Pi’s softwares and install realvnc which will be used to setup remote sessions.

9— Access Pi remotely

On the raspberry pi’s ssh prompt, type in to start the service. This will print an ipaddress where you can access the desktop remotely, note that down. Mine says

To access the remote desktop, you need a vncviewer (client) for your laptop. Fortunately RealVNC is available for a lot of OSes, pick one for your OS from

If you are on debian/ubuntu, you might have to do some additional step after downloading the executable.

RealVNC viewer

Here we are changing the file mode of the downloaded executable to make it installable. We are also moving the executable from the downloads folder to the home folder.

Once RealVNC viewer is installed, add the raspberry pi device to the connections (File > New connection). Enter the pi’s desktop identifier ( ), give it a friendly name, click Ok. Enter pi’s username and password when prompted. That’s it, you should now see the desktop. Give me a five!

Raspberry Pi’s Remote desktop

10 — Remote control from the internet

No more port forwarding and fiddling with router settings, Team Viewer has released a version for Arm based devices and we are gonna use that. Yaay!

Start by SSHing into your headless device and from the terminal do

Once downloaded you can install it using:

You can the teamviewer deb file after installation.

Now now, how do I setup a remote session with this?

After installing we should have a cli tool installed on the pi. Lets check if the teamviewer daemon is running.

Should return a lot of text in which you will find “active (running)” in it.

In you don’t find that, try

Once that’s done, let’s do the setup. You need a teamview account. If you don’t have one, go to and create one. After that type in

accept any license terms and input the emailid and password you gave in the signup process. Since this is the first time you are trying to remote control this device from this account, you should get an email to Add device to trusted list

Click on the link in the email to do that. If required, try the setup command again and in the end you should get this nice text

*** You have successfully added this computer to your Computers & Contacts. You can now access it with a simple double click in your Computers & Contacts list. ***

Open (or install) team viewer in your laptop. Sign In. You should see the Raspberry Pi device listed under “your computers”. Simply double click and start controlling it over the internet.

Don’t tell anyone, It even works after you restart you pi 😉

💥 💥 💥


preparing the file

Finding the wifi ssid

Finding ipaddress of pi

Installing teamviewer for Arm devices


Coinmonks is a non-profit Crypto educational publication.


Coinmonks is a non-profit Crypto educational publication. Follow us on Twitter @coinmonks Our other project -


Written by


Codes in python. Rants about ML and stuff. Trains to be a coding superhero.


Coinmonks is a non-profit Crypto educational publication. Follow us on Twitter @coinmonks Our other project -