{"id":536,"date":"2020-10-22T00:25:14","date_gmt":"2020-10-22T00:25:14","guid":{"rendered":"https:\/\/dft.wiki\/?p=536"},"modified":"2026-06-09T13:30:44","modified_gmt":"2026-06-09T17:30:44","slug":"setting-up-a-headless-raspberry-pi-ssh-vnc-wifi","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=536","title":{"rendered":"Setting Up a Headless Raspberry Pi + SSH + VNC + WiFi"},"content":{"rendered":"<p>The following steps will work on any Raspberry Pi running Raspberry Pi OS, regardless of the model.<\/p>\n<p>Use the installation tool to write the operating system to the memory card. Downloads are available on the official website [<a href=\"https:\/\/www.raspberrypi.org\/downloads\/\">Link<\/a>].<\/p>\n<p>Create an empty file called ssh inside the <code>boot<\/code> partition:<\/p>\n<pre>sudo touch ssh<\/pre>\n<p>Then add the Wi-Fi configuration inside the <code>rootfs<\/code> partition:<\/p>\n<pre>sudo nano etc\/wpa_supplicant\/wpa_supplicant.conf<\/pre>\n<p>Add these lines at the end of the file, replacing <strong>SSID<\/strong> and <strong>PASSWORD<\/strong>. You can repeat this block more than once to configure multiple networks:<\/p>\n<pre>network={\r\n  ssid=\"<strong>SSID<\/strong>\"\r\n  psk=\"<strong>PASSWORD<\/strong>\"\r\n}<\/pre>\n<p>Boot the Raspberry Pi with the newly created image. SSH and Wi-Fi are now configured, and the default hostname is &#8220;<strong>raspberrypi<\/strong>&#8220;. Try connecting using the hostname first.<\/p>\n<p>If the hostname does not work, find the IP address assigned to your RPi:<\/p>\n<pre>sudo arp-scan \u2010\u2010interface=<strong>wlan0<\/strong> \u2010\u2010localnet<\/pre>\n<p>Replace <strong>wlan0<\/strong> with your own adapter name.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-539 size-full\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2020\/10\/arp_scan.png\" alt=\"\" width=\"818\" height=\"324\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2020\/10\/arp_scan.png 818w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2020\/10\/arp_scan-300x119.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2020\/10\/arp_scan-768x304.png 768w\" sizes=\"auto, (max-width: 818px) 100vw, 818px\" \/><\/p>\n<p>In this example, the assigned IP is <strong>192.168.2.102<\/strong>, so connect via SSH:<\/p>\n<pre>ssh pi@<strong>192.168.2.102<\/strong><\/pre>\n<p>The default password is &#8220;<strong>raspberry<\/strong>&#8220;.<\/p>\n<pre>sudo raspi-config<\/pre>\n<p>Go to Rasp-Config &gt; Interfacing Options &gt; VNC &gt; Yes.<\/p>\n<p>You can now use any VNC viewer to access your RPi. RealVNC is a good option [<a href=\"https:\/\/www.realvnc.com\/en\/connect\/download\/viewer\/\">Link<\/a>].<\/p>\n<p>Use the same IP address to connect via VNC, just as you did with SSH.<\/p>\n<p>Recommendations:<\/p>\n<ul>\n<li>Install UFW;<\/li>\n<li>Allow port 22 (SSH);<\/li>\n<li>Allow port 5900 (VNC);<\/li>\n<li>Enable the firewall to run at startup;<\/li>\n<li>If your RPi does not connect to Wi-Fi, consider connecting via Bluetooth Network (PAN) as a fallback [<a href=\"https:\/\/dft.wiki\/?p=392\">Read It<\/a>].<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The following steps will work on any Raspberry Pi running Raspberry Pi OS, regardless of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-536","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=536"}],"version-history":[{"count":14,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/536\/revisions"}],"predecessor-version":[{"id":5815,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/536\/revisions\/5815"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}