{"id":536,"date":"2020-10-22T00:25:14","date_gmt":"2020-10-22T00:25:14","guid":{"rendered":"https:\/\/dft.wiki\/?p=536"},"modified":"2021-11-18T00:12:01","modified_gmt":"2021-11-18T00:12:01","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 in any Raspberry Pi with Raspbian (now called Raspberry Pi OS), regardless of the model.<\/p>\n<p>Use the installation tool to write the operating system in the memory card. Follow the official website link for downloads [<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 wifi 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 the <strong>SSID<\/strong> and <strong>PASSWORD<\/strong> (you can add more than these lines more than once to be able to connect to more networks):<\/p>\n<pre>network={\r\n  ssid=\"<strong>SSID<\/strong>\"\r\n  psk=\"<strong>PASSWORD<\/strong>\"\r\n}<\/pre>\n<p>Run the Raspberry Pi with the newly created image with SSH and WIFI configured. It also comes with the default hostname &#8220;<strong>raspberrypi<\/strong>&#8220;, you probably try to connect using the hostname.<\/p>\n<p>If the hostname did not work, find out the IP obtained by 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 my case, it got the IP: <strong>192.168.2.102<\/strong>, so let&#8217;s access it via SSH:<\/p>\n<pre>ssh pi@<strong>192.168.2.102<\/strong><\/pre>\n<p>Remember, the default password is &#8220;<strong>raspberry<\/strong>&#8220;.<\/p>\n<pre>sudo raspi-config<\/pre>\n<p>In the Rasp-Config &gt; Interfacing Options &gt; VNC &gt; Yes.<\/p>\n<p>Now you can use any VNC viewer to access your RPi. I recommend the RealVNC [<a href=\"https:\/\/www.realvnc.com\/en\/connect\/download\/viewer\/\">Link<\/a>].<\/p>\n<p>Use the IP to connect via VNC, as you did with the SSH.<\/p>\n<p>Recommendations:<\/p>\n<ul>\n<li>Install UFW;<\/li>\n<li>Allow ports 22 (SSH);<\/li>\n<li>Allow port 5900 (VNC);<\/li>\n<li>Enable the firewall to run at the startup;<\/li>\n<li>In case your RPi does not connect to the WIFI, it is also a good idea to be able to connect to it via Bluetooth Network (PAN), read the following post [<a href=\"https:\/\/dft.wiki\/?p=392\">Read It<\/a>].<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The following steps will work in any Raspberry Pi with Raspbian (now called Raspberry Pi [&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":13,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/536\/revisions"}],"predecessor-version":[{"id":2554,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/536\/revisions\/2554"}],"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}]}}