How to Start a Fresh Raspberry Pi without Monitor


I mean using SSH because HDMI, mouse, keyboard, and monitor will eat up the whole space in my desk.

Prepare the Raspberry Pi OS

Firstly we need to get our microSD card with bootable Raspberry Pi OS. I recommend using Raspberry Pi Imager to make this process easier. We just need 3 steps, download the Raspberry Pi Imager then, choose our preferred OS, select the SD card, then write.

Access SSH to Raspberry Pi

By default, SSH access is not allowed. After we wrote the image of Raspbian on our SD card. Create an empty file called ssh inside the boot partition. This will enable SSH access to your Raspberry Pi.

[Update]: Create The Account

Raspberry Pi WIFI Auto Connect

Previously the raspberry pi default account was pi:raspberry but due to security reasons, they disabled the default account, and now you must create your own account before logging in.

In this tutorial we will still use the default account so let’s generate the hash for the password:

echo 'raspberry' | openssl passwd -6 -stdin

Copy that result. Then, create a userconf file in the boot volume and write:

username:encrypted-password

In our case, we use pi as username and the value of encrypted-password is the output of the OpenSSL command previously.

Next, just access the Raspberry Pi using an ethernet cable by using the IP address. But if we prefer to use wifi, we need to enable the auto-connect to the wifi. Still inside the boot partition, in the same folder, create a file called wpa_supplicant.conf and write it down like this:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
scan_ssid=1
ssid="your_wifi_ssid"
psk="your_wifi_password"
}

Change the parameter wifi SSID and password to match our router and save the file.

Now each time you boot up the Raspberry Pi, using your PC in the same network, you can find your Raspberry Pi already connected to the network without any user interfaces needed.

Finding the Raspberry Pi IP Address

There are many ways to find the Raspberry Pi IP address if we connect the Raspberry Pi via a DHCP router or local network. Usually, I used arp-scan for this.

But you can try to ping your Raspberry Pi first using the hostname:

ping raspberrypi.local
ibndias@shaheen:~$ ping raspberrypi.local
PING raspberrypi.local (10.0.3.XX) 56(84) bytes of data.
64 bytes from 10.0.3.XX (10.0.3.XX): icmp_seq=1 ttl=64 time=3.13 ms
64 bytes from 10.0.3.XX (10.0.3.XX): icmp_seq=2 ttl=64 time=1.86 ms
^C
--- raspberrypi.local ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.861/2.496/3.131/0.635 ms

If there is an answer, then that’s your Raspberry Pi IP. But if it doesn’t work, you can try using arp-scan. Install the arp-scan on your host PC:

sudo apt install arp-scan

Then scan your local network by using:

sudo arp-scan -l

ibndias@shaheen:~$ sudo arp-scan -l
 Interface: eno1, type: EN10MB, MAC: xx:xx:xx:xx:xx:xx, IPv4: 10.0.3.XXX
 Starting arp-scan 1.9.7 with 256 hosts (https://github.com/royhills/arp-scan)
 10.0.3.X    xx:xx:xx:xx:xx:xx   (Unknown)
 10.0.3.XX    xx:xx:xx:xx:xx:xx   EFM Networks
 10.0.3.XX    xx:xx:xx:xx:xx:xx   NETGEAR
 10.0.3.XXX    xx:xx:xx:xx:xx:xx   Samsung Electronics Co.,Ltd
 10.0.3.XXX    xx:xx:xx:xx:xx:xx   Apple, Inc.
 10.0.3.176    xx:xx:xx:xx:xx:xx   Raspberry Pi Trading Ltd

Here you can see that our Raspberry Pi IP is 10.0.3.176. We can start to connect via SSH by using our previously created account.

ssh pi@10.0.3.176

And the default password is raspberry.

ibndias@shaheen:~$ ssh pi@10.0.3.176
 Linux raspberrypi 5.4.72-v7l+ #1356 SMP Thu Oct 22 13:57:51 BST 2020 armv7l
 The programs included with the Debian GNU/Linux system are free software;
 the exact distribution terms for each program are described in the
 individual files in /usr/share/doc/*/copyright.
 Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
 permitted by applicable law.
 Last login: Wed Nov 18 09:37:57 2020
 SSH is enabled and the default password for the 'pi' user has not been changed.
 This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
 pi@raspberrypi:~ $

That’s it, and now we can use our Raspberry Pi without cluttering our desks. 😉


Leave a Reply

Your email address will not be published. Required fields are marked *