{"id":374,"date":"2017-02-20T13:45:54","date_gmt":"2017-02-20T21:45:54","guid":{"rendered":"http:\/\/www.nathanbak.com\/?p=374"},"modified":"2026-01-02T20:04:41","modified_gmt":"2026-01-03T04:04:41","slug":"configuring-a-raspberry-pi-from-another-computer","status":"publish","type":"post","link":"https:\/\/nathanbak.com\/?p=374","title":{"rendered":"Configuring a Raspberry Pi from Another Computer"},"content":{"rendered":"<h3>Introduction<\/h3>\n<p>One thing I like about the Raspberry Pi is that it&#8217;s a small gadget that, once configured, only needs power in order to sit somewhere and do something.\u00a0 For example, <a href=\"http:\/\/www.nathanbak.com\/?p=152\">BakBoard<\/a> runs on a Raspberry Pi that only plugs into a TV (for both power and display).\u00a0 Unfortunately, in order to get everything running, I typically have ended up connecting various extra wires (network, keyboard, mouse, display) and work directly on the Pi before I can stick it in some random location to do what I want it to do.\u00a0 Below are the steps I figured out so that I can do everything from my main computer and the only wire I need to my Pi is for power.<\/p>\n<h3>Prereqs<\/h3>\n<ul>\n<li>My main computer is currently running Ubuntu 16.04 although I think it would be easy to adapt the steps for most operating systems.<\/li>\n<li>I have an SD card (32 GB in my case, but it probably only needs to be about 4GB).<\/li>\n<li>I have an SD card adapter so I can read\/write the SD card from my computer.<\/li>\n<\/ul>\n<h3>OS Image<\/h3>\n<p>To get the base image, I went to the <a href=\"https:\/\/www.raspberrypi.org\/downloads\/\">Raspberry Pi Downloads Page<\/a> and grabbed the latest Raspbian image (specifically 2017-01-11-raspbian-jessie-lite).\u00a0 Once I had downloaded the zip, I opened it and then doubled clicked the image file (2017-01-11-raspbian-jessie-lite.img).\u00a0 This brought up the Ubuntu image tool and it was easy to &#8220;restore&#8221; the image to the SD Card.<\/p>\n<h3>Wireless Networking<\/h3>\n<p>Since I don&#8217;t want to mess with a network cable, I want my Pi to be able to access my wireless network.\u00a0 In order to do so, I modified the interfaces file.\u00a0 It is in the image at etc\/network\/images.\u00a0 Basically I changed the bit:<\/p>\n<pre>iface wlan0 inet manual\r\n\u00a0\u00a0\u00a0 wpa-conf \/etc\/wpa_supplicant\/wpa_supplicant.conf<\/pre>\n<p>To be:<\/p>\n<pre>iface wlan0 inet dhcp\r\n\u00a0\u00a0\u00a0 wpa-ssid \"NATHANS_NETWORK\"\r\n\u00a0\u00a0\u00a0 wpa-psk \"NATHANS_PASSWORD\"\r\n\r\n<\/pre>\n<p>Obviously I plugged in the correct network name and password.<\/p>\n<h3>Enable SSH<\/h3>\n<p>The Raspbian OS used to have SSH enabled by default, but last year that changed as a security precaution.\u00a0 The explanation for the change (and where I learned to do what is described below) is described on the <a href=\"https:\/\/www.raspberrypi.org\/blog\/a-security-update-for-raspbian-pixel\/\">Raspberry Pi Blog<\/a>.<\/p>\n<p>Basically, to enable ssh, I just create a file called &#8220;ssh&#8221; in the boot directory.\u00a0 The contents of boot\/ssh don&#8217;t matter&#8211;apparently the OS will see that file, enable ssh, and then delete the file.\u00a0 The tricky part was that there were two &#8220;boot&#8221; directories.\u00a0 There was one at the root of the volume, but there was actually a separate volume as well that is named boot&#8211;that&#8217;s the one where the ssh file must be created.<\/p>\n<h3>Authentication<\/h3>\n<p>The default password to\u00a0 the Raspberry Pi is well-known which is nice because I don&#8217;t have to remember yet another password, but also a security risk since everyone knows it.\u00a0 Instead, I like to use key based authentication and disable password authentication for ssh access.\u00a0 Here&#8217;s how I did that:<\/p>\n<p>First, I generated my public and private key (that was done a long time ago, and there are plenty of sources on the Internet how to do that).\u00a0 My public key is id_rsa.pub (in the .ssh folder in my home directory) and the private key is id_rsa.\u00a0 That creation was on my main computer.\u00a0 Then, on the Raspberry Pi volume, I created the directory home\/pi\/.ssh.\u00a0 I then copied the public key file (id_rsa.pub) into the home\/pi\/.ssh folder and also copied the file and named the copy &#8220;authorized_keys&#8221;.<\/p>\n<p>Then, to disable password authentication via SSH I opened up the file etc\/ssh\/sshd_config in a text editor and changed:<\/p>\n<pre>#PasswordAuthentication yes\r\n\r\nUsePAM yes<\/pre>\n<p>To be:<\/p>\n<pre>PasswordAuthentication no\r\n\r\nUsePAM no<\/pre>\n<h3>Conclusion<\/h3>\n<p>Once the above has been completed, I can stick the SD card into the Raspberry Pi and then plug in the Pi (giving it power).\u00a0 It automatically connects to the wifi and I&#8217;m able to SSH into it without a password.\u00a0 There&#8217;s nothing new here that can&#8217;t be found in various places online, but I&#8217;ve gathered the pieces together for my own reference at least.\u00a0 Here are a few &#8220;gotchas&#8221; I encountered along the way:<\/p>\n<ul>\n<li>All of the paths mentioned above are relative paths&#8211;the volume might be mounted in various places&#8211;in my place it was something like \/media\/nathan\/90asd8f60s9g69789sd6gjherlkuyds8 for the main volume and \/media\/nathan\/boot for the boot volume.<\/li>\n<li>As mentioned before, there are two &#8220;boot&#8221; directories&#8211;make sure that the &#8220;ssh&#8221; file is created in the boot volume.<\/li>\n<li>In order to create\/modify some of the files, I had to use sudo (or change to root).<\/li>\n<li>I the past, I used to have to run raspi-config to expand the volume to use all available space on the SD card, but that no longer seems necessary&#8211;it now seems to happen automagically.<\/li>\n<li>Even though password authentication is disabled for SSH access, whenever logging in there is still a warning.\u00a0 I usually do change the password and just write it down somewhere since I never use it.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction One thing I like about the Raspberry Pi is that it&#8217;s a small gadget that, once configured, only needs power in order to sit somewhere and do something.\u00a0 For example, BakBoard runs on a Raspberry Pi that only plugs into a TV (for both power and display).\u00a0 Unfortunately, in order to get everything running, &hellip; <a href=\"https:\/\/nathanbak.com\/?p=374\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Configuring a Raspberry Pi from Another Computer&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5,10,18],"class_list":["post-374","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-bakboard","tag-making","tag-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/nathanbak.com\/index.php?rest_route=\/wp\/v2\/posts\/374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nathanbak.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nathanbak.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nathanbak.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nathanbak.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=374"}],"version-history":[{"count":7,"href":"https:\/\/nathanbak.com\/index.php?rest_route=\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":381,"href":"https:\/\/nathanbak.com\/index.php?rest_route=\/wp\/v2\/posts\/374\/revisions\/381"}],"wp:attachment":[{"href":"https:\/\/nathanbak.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nathanbak.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nathanbak.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}