{"id":8980,"date":"2018-05-05T21:38:27","date_gmt":"2018-05-06T04:38:27","guid":{"rendered":"https:\/\/dylanmc.ca\/\/-\/?p=8980"},"modified":"2024-08-20T11:23:22","modified_gmt":"2024-08-20T18:23:22","slug":"my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing","status":"publish","type":"post","link":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/","title":{"rendered":"My tiny file server with Ubuntu Core, Nextcloud and Syncthing"},"content":{"rendered":"\n<p>My annual Dropbox renewal date was coming up, and I thought to myself &#8220;I&#8217;m working with servers all the time. I shouldn&#8217;t need to pay someone else for this.&#8221; I was also knee deep in a math course, so I felt like procrastinating.<\/p>\n\n\n\n<p>I&#8217;m really happy with the result, so I thought I would explain it for anyone else who wants to do the same. Here&#8217;s what I was aiming for:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Safe, convenient archiving for big files.<\/li><li>Instant sync between devices for stuff I&#8217;m working on.<\/li><li>Access over LAN from home, and over the Internet from anywhere else.<\/li><li>Regular, encrypted offsite backups.<\/li><li>Compact, low power hardware that I can stick in a closet and forget about.<\/li><li>Some semblance of security, at least so a compromised service won&#8217;t put the rest of the system at risk.<\/li><\/ul>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">The hardware<\/h2>\n\n\n\n<p>I dabbled with a BeagleBoard that I used for an embedded systems course, and I pondered a Raspberry Pi with a case. I decided against both of those, because I wanted something with a bit more wiggle room. And besides, I like having a BeagleBoard <a href=\"https:\/\/github.com\/dylanmccall\/pigeond\">free to mess around with<\/a> now and then.<\/p>\n\n\n\n<p>In the end, I picked out <a href=\"https:\/\/www.intel.com\/content\/www\/us\/en\/products\/boards-kits\/nuc\/kits\/nuc7cjyh.html\">an Intel NUC<\/a>, and I threw in an old SSD and a stick of RAM:<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"394\" data-attachment-id=\"9051\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/img_20180428_013430\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg?fit=4048%2C3036&amp;ssl=1\" data-orig-size=\"4048,3036\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;Pixel&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1524879270&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.67&quot;,&quot;iso&quot;:&quot;632&quot;,&quot;shutter_speed&quot;:&quot;0.033333&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"An Intel NUC from the front\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg?fit=300%2C225&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg?fit=525%2C394&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg?resize=525%2C394&#038;ssl=1\" alt=\"\" data-id=\"9051\" class=\"wp-image-9051\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg?w=4048&amp;ssl=1 4048w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg?resize=300%2C225&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg?resize=768%2C576&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg?resize=750%2C563&amp;ssl=1 750w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg?w=1050&amp;ssl=1 1050w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg?w=1575&amp;ssl=1 1575w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"394\" data-attachment-id=\"9050\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/img_20180428_013506\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013506.jpg?fit=4048%2C3036&amp;ssl=1\" data-orig-size=\"4048,3036\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;Pixel&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1524879306&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.67&quot;,&quot;iso&quot;:&quot;1208&quot;,&quot;shutter_speed&quot;:&quot;0.033333&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"An Intel NUC from the back\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013506.jpg?fit=300%2C225&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013506.jpg?fit=525%2C394&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013506.jpg?resize=525%2C394&#038;ssl=1\" alt=\"\" data-id=\"9050\" class=\"wp-image-9050\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013506.jpg?w=4048&amp;ssl=1 4048w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013506.jpg?resize=300%2C225&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013506.jpg?resize=768%2C576&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013506.jpg?resize=750%2C563&amp;ssl=1 750w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013506.jpg?w=1050&amp;ssl=1 1050w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013506.jpg?w=1575&amp;ssl=1 1575w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>It&#8217;s tiny, it&#8217;s quiet, and it looks okay too! (Just find somewhere to hide the power brick). My only real complaint is the wifi hardware doesn&#8217;t work with older Linux kernels, but that wasn&#8217;t a big deal for my needs and I&#8217;m sure it will work in the future.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The software<\/h2>\n\n\n\n<p>I installed <a href=\"https:\/\/www.ubuntu.com\/core\">Ubuntu Core 16<\/a>, which is <em>delightful<\/em>. Installing it is a bit surprising for the uninitiated because there isn&#8217;t really an install process: you just clone the image to the drive you want to boot from and you&#8217;re done. It&#8217;s easier if you do this while the drive is connected to another computer. (I didn&#8217;t feel like switching around SATA cables in my desktop, so I needed to write a different OS to a flash drive, boot from that on the NUC, transfer the Ubuntu Core image to there, then dd that image to the SSD. Kind of weird for this use case).<\/p>\n\n\n\n<p>Now that I figured out how to run it, I&#8217;ve been enjoying how this system is designed to minimize the time you need to spend with your device connected to a screen and keyboard like some kind of savage. There&#8217;s a simple setup process (configure networking, log in to your Ubuntu One account), and that&#8217;s it. You can bury the thing somewhere and SSH to it from now on. In fact, you&#8217;re pretty much forced to: you don&#8217;t even get a login prompt. Chances are you won&#8217;t need to SSH to the system anyway since it keeps itself up to date. As someone who obsesses over loose threads, I&#8217;m finding this all very satisfying.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"288\" data-attachment-id=\"9120\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-from-2018-05-05-13-41-29\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-05-13-41-29.png?fit=714%2C392&amp;ssl=1\" data-orig-size=\"714,392\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Ubuntu Core 16 login\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Ubuntu Core 16 after initial setup. If a console accepts input and no screen is around to print it, does it make a sound? Worry no more.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-05-13-41-29.png?fit=300%2C165&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-05-13-41-29.png?fit=525%2C288&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-05-13-41-29.png?resize=525%2C288&#038;ssl=1\" alt=\"\" data-id=\"9120\" class=\"wp-image-9120\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-05-13-41-29.png?w=714&amp;ssl=1 714w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-05-13-41-29.png?resize=300%2C165&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>Although, with that in mind, one important thing: if you haven&#8217;t played with Ubuntu for a while, head over to <a href=\"https:\/\/login.ubuntu.com\/\">login.ubuntu.com<\/a> and make sure your SSH keys are up to date. The first time I set it up, I realized I had a bunch of obsolete SSH keys in my account and I had no way to reach the system from the laptop I was using. Fixing that meant changing Ubuntu Core&#8217;s writable files from another operating system. (I would love to know if there is a better way).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The other software<\/h2>\n\n\n\n<p>Okay, using Ubuntu Core is probably a bit weird when I want to run all these servers and I&#8217;m probably a little picky, but it&#8217;s so elegant! And, happily, there are Snap packages for both <a href=\"https:\/\/nextcloud.com\/\">Nextcloud<\/a> and <a href=\"https:\/\/syncthing.net\/\">Syncthing<\/a>. I ended up using both.<\/p>\n\n\n\n<p>I really like how files you can edit are tucked away in <em>\/writable<\/em>. For this guide,&nbsp; I always refer to things by their full paths under \/writable. I found thinking like that spared me getting lost in files that I couldn&#8217;t change, and it helped to emphasize the nature of this system.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">DNS<\/h3>\n\n\n\n<p>Before I get to the fun stuff, there were some networking conundrums I needed to solve.<\/p>\n\n\n\n<p>First, public DNS. My router has some buttons if you want to use a dynamic DNS service, but I just rolled my own thing. To start off, I added some additional records for my DNS pointing at my home IP address. My web host has an API for editing DNS rules, so I set up a dynamic DNS after everything else was working, but I will get to that further along.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"162\" data-attachment-id=\"9113\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-2018-5-5-add-dns-resource-record-example-com-nearlyfreespeech-net-member-interface\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Add-DNS-Resource-Record-example-com-NearlyFreeSpeech-NET-Member-Interface.png?fit=1165%2C360&amp;ssl=1\" data-orig-size=\"1165,360\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"DNS settings\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Adding a DNS record for core.example.com.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Add-DNS-Resource-Record-example-com-NearlyFreeSpeech-NET-Member-Interface.png?fit=300%2C93&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Add-DNS-Resource-Record-example-com-NearlyFreeSpeech-NET-Member-Interface.png?fit=525%2C162&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Add-DNS-Resource-Record-example-com-NearlyFreeSpeech-NET-Member-Interface.png?resize=525%2C162&#038;ssl=1\" alt=\"\" data-id=\"9113\" class=\"wp-image-9113\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Add-DNS-Resource-Record-example-com-NearlyFreeSpeech-NET-Member-Interface.png?w=1165&amp;ssl=1 1165w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Add-DNS-Resource-Record-example-com-NearlyFreeSpeech-NET-Member-Interface.png?resize=300%2C93&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Add-DNS-Resource-Record-example-com-NearlyFreeSpeech-NET-Member-Interface.png?resize=768%2C237&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Add-DNS-Resource-Record-example-com-NearlyFreeSpeech-NET-Member-Interface.png?resize=750%2C232&amp;ssl=1 750w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Add-DNS-Resource-Record-example-com-NearlyFreeSpeech-NET-Member-Interface.png?w=1050&amp;ssl=1 1050w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>Next, my router didn&#8217;t support hairpinning (or NAT Loopback), so requests to core<em>.example.com<\/em> were still resolving to my public IP address, which means way too many hops for sending data around. My ridiculous solution: I&#8217;ll run my own DNS server, darnit.<\/p>\n\n\n\n<p>To get started, check the network configuration in <em>\/writable\/system-data\/etc\/netplan\/00-snapd-config.yaml<\/em>. You&#8217;ll want to make sure the system requests a static IP address (I used <em>192.168.1.2<\/em>) and uses its own nameservers. Mine looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">network:\n  ethernets:\n    eth0:\n      dhcp4: <strong>false<\/strong>\n      dhcp6: <strong>false<\/strong>\n      <strong>addresses: [192.168.1.2\/24, '2001:1::2\/64']<\/strong>\n      <strong>gateway4: 192.168.1.1\n      nameservers:<\/strong>\n        <strong>addresses: [8.8.8.8, 8.8.4.4]<\/strong>\n  version: 2<\/pre>\n\n\n\n<p>After changing the Netplan configuration, use <code>sudo netplan generate<\/code> to update the system.<\/p>\n\n\n\n<p>For the actual DNS server, we can install an unofficial snap that provides dnsmasq:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ snap install dnsmasq-escoand<\/pre>\n\n\n\n<p>You&#8217;ll want to edit&nbsp; <em>\/writable\/system-data\/etc\/hosts<\/em> so the service&#8217;s domains resolve to the devices&#8217;s local IP address:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">127.0.0.1 localhost.localdomain localhost\n::1 localhost6.localdomain6 localhost6\n\n<strong>192.168.1.2 <em>core.example.com<\/em><\/strong>\n<strong>fe80::96c6:91ff:fe1a:6581 <em>core.example.com<\/em><\/strong>\n\n\u2026<\/pre>\n\n\n\n<p>Now it&#8217;s safe to go into your router&#8217;s configuration, reserve an IP address for this device, and set it as your DNS server:<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"81\" data-attachment-id=\"9010\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-2018-4-28-netgear-router-r6400v2-address-reservation\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Address-reservation.png?fit=795%2C123&amp;ssl=1\" data-orig-size=\"795,123\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Router address reservation\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Reserving a static IP for core.example.com in the router&amp;#8217;s settings\u2026&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Address-reservation.png?fit=300%2C46&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Address-reservation.png?fit=525%2C81&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Address-reservation.png?resize=525%2C81&#038;ssl=1\" alt=\"\" data-id=\"9010\" class=\"wp-image-9010\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Address-reservation.png?w=795&amp;ssl=1 795w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Address-reservation.png?resize=300%2C46&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Address-reservation.png?resize=768%2C119&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Address-reservation.png?resize=750%2C116&amp;ssl=1 750w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"132\" data-attachment-id=\"9011\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-2018-4-28-netgear-router-r6400v2-dns-address\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-DNS-address.png?fit=650%2C163&amp;ssl=1\" data-orig-size=\"650,163\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Router DNS address\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;\u2026 and using that IP for the DNS server.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-DNS-address.png?fit=300%2C75&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-DNS-address.png?fit=525%2C132&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-DNS-address.png?resize=525%2C132&#038;ssl=1\" alt=\"\" data-id=\"9011\" class=\"wp-image-9011\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-DNS-address.png?w=650&amp;ssl=1 650w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-DNS-address.png?resize=300%2C75&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>And that solved it.<\/p>\n\n\n\n<p>To check, run <em>tracepath<\/em> from another computer on your network and the result should be something simple like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ tracepath <em>core.example.com<\/em>\n 1?: [LOCALHOST] pmtu 1500\n 1: <em>core.example.com<\/em> 0.789ms reached\n 1: <em>core.example.com<\/em> 0.816ms reached\n Resume: pmtu 1500 hops 1 back 1<\/pre>\n\n\n\n<p>While you&#8217;re looking at the router, you may as well forward some ports, too. By default you need TCP ports 80 and 443 for Nextcloud, and 22000 for Syncthing.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"82\" data-attachment-id=\"9043\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-2018-4-28-netgear-router-r6400v2-port-forward\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Port-forward.png?fit=884%2C138&amp;ssl=1\" data-orig-size=\"884,138\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Router port forwarding\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Forwarding some TCP ports for core.example.com.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Port-forward.png?fit=300%2C47&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Port-forward.png?fit=525%2C82&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Port-forward.png?resize=525%2C82&#038;ssl=1\" alt=\"\" data-id=\"9043\" class=\"wp-image-9043\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Port-forward.png?w=884&amp;ssl=1 884w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Port-forward.png?resize=300%2C47&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Port-forward.png?resize=768%2C120&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-NETGEAR-Router-R6400v2-Port-forward.png?resize=750%2C117&amp;ssl=1 750w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Nextcloud<\/h3>\n\n\n\n<p><a href=\"https:\/\/snapcraft.io\/nextcloud\">The Nextcloud snap<\/a> is fantastic. It already works out of the box: it adds a system service for its copy of Apache on port 80, and it comes with a bunch of scripts for setting up common things like SSL certificates. I wanted to use an external hard drive for its data store, so I needed to configure the mount point for that and grant the necessary permissions for the snap to access removable media.<\/p>\n\n\n\n<p>Let&#8217;s set up that mount point first. These are configured with <a href=\"https:\/\/www.freedesktop.org\/software\/systemd\/man\/systemd.mount.html\">Systemd mount units<\/a>, so we&#8217;ll want to create a file like <em>\/writable\/system-data\/etc\/systemd\/system\/media-data1.mount<\/em>. You need to tell it how to identify the storage device. (I always give them nice volume labels when I format them so it&#8217;s easy to use that). Note that the name of the unit file must correspond to the full name of the mount point:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Unit]\nDescription=Mount unit for data1\n\n[Mount]\nWhat=\/dev\/disk\/by-label\/data1\nWhere=\/media\/data1\nType=ext4\n\n[Install]\nWantedBy=multi-user.target\n\n<\/pre>\n\n\n\n<p>One super cool thing here is you can start and stop the mount unit just like any other system service:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo systemctl daemon-reload\n$ sudo systemctl start media-data1.mount\n$ sudo systemctl enable media-data1.mount<\/pre>\n\n\n\n<p>Now let&#8217;s set up Nextcloud. The <a href=\"https:\/\/github.com\/nextcloud\/nextcloud-snap\">code repository for the Nextcloud snap<\/a> has lots of documentation if you need.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ snap install nextcloud\n$ snap connect nextcloud:removable-media :removable-media\n$ sudo snap run nextcloud.manual-install USERNAME PASSWORD\n$ snap stop nextcloud<\/pre>\n\n\n\n<p>Before we do anything else we need to tell Nextcloud to store its data in <em>\/media\/data1\/nextcloud\/<\/em>, and allow access through the public domain from earlier. To do that, edit <em>\/writable\/system-data\/var\/snap\/nextcloud\/current\/nextcloud\/config\/config.php<\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n$CONFIG = array (\n 'apps_paths' =&gt;\n array (\n \u2026\n ),\n \u2026\n 'trusted_domains' =&gt;\n array (\n 0 =&gt; 'localhost',\n 1 =&gt; '<em><strong>core.example.com<\/strong><\/em>'\n ),\n 'datadirectory' =&gt; '<strong>\/media\/data1\/nextcloud\/data<\/strong>',\n \u2026\n);<\/pre>\n\n\n\n<p>Move the existing data directory to the new location, and restart the service:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ snap stop nextcloud\n$ sudo mkdir \/media\/data1\/nextcloud\n$ sudo mv \/writable\/system-data\/var\/snap\/nextcloud\/common\/nextcloud\/data \/media\/data1\/nextcloud\/\n$ snap start nextcloud<\/pre>\n\n\n\n<p>Now you can enable HTTPS. There is a lets-encrypt option (for <a href=\"https:\/\/letsencrypt.org\/\">letsencrypt.org<\/a>), which is very convenient:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo snap run nextcloud.enable-https lets-encrypt -d\n$ sudo snap run nextcloud.enable-https lets-encrypt<\/pre>\n\n\n\n<p>At this point you should be able to reach Nextcloud from another computer on your network, or remotely, using the same domain.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-6 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"309\" data-attachment-id=\"9023\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-2018-4-27-nextcloud\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-27-Nextcloud.jpg?fit=1445%2C850&amp;ssl=1\" data-orig-size=\"1445,850\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Nextcloud login screen\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Pretty!&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-27-Nextcloud.jpg?fit=300%2C176&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-27-Nextcloud.jpg?fit=525%2C309&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-27-Nextcloud.jpg?resize=525%2C309&#038;ssl=1\" alt=\"\" data-id=\"9023\" class=\"wp-image-9023\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-27-Nextcloud.jpg?w=1445&amp;ssl=1 1445w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-27-Nextcloud.jpg?resize=300%2C176&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-27-Nextcloud.jpg?resize=768%2C452&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-27-Nextcloud.jpg?resize=750%2C441&amp;ssl=1 750w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-27-Nextcloud.jpg?w=1050&amp;ssl=1 1050w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"375\" data-attachment-id=\"9117\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-from-2018-05-04-23-01-29\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-01-29.png?fit=1016%2C726&amp;ssl=1\" data-orig-size=\"1016,726\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"GNOME Online Accounts settings\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;You can add your Nextcloud account in GNOME Settings.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-01-29.png?fit=300%2C214&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-01-29.png?fit=525%2C375&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-01-29.png?resize=525%2C375&#038;ssl=1\" alt=\"\" data-id=\"9117\" class=\"wp-image-9117\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-01-29.png?w=1016&amp;ssl=1 1016w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-01-29.png?resize=300%2C214&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-01-29.png?resize=768%2C549&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-01-29.png?resize=750%2C536&amp;ssl=1 750w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Syncthing<\/h3>\n\n\n\n<p>If you aren&#8217;t me, you can probably stop here and use Nextcloud, but I decided Nextcloud wasn&#8217;t quite right for all of my files, so I added Syncthing to the mix. It&#8217;s like a peer to peer Dropbox, with a somewhat more geeky interface. You can link your devices by globally unique IDs, and they&#8217;ll find the best way to connect to each other and automatically sync files between your shared folders. It&#8217;s very elegant, but I wasn&#8217;t sure about using it without some kind of central repository. This way my systems will sync between each other when they can, but there&#8217;s one central device that is always there, ready to send or receive the newest versions of everything.<\/p>\n\n\n\n<p><a href=\"https:\/\/snapcraft.io\/syncthing\">Syncthing has a snap<\/a>, but it is a bit different from Nextcloud, so the package needed a few extra steps. Syncthing, like Dropbox, runs one instance for each user, instead of a monolithic service that serves many users. So, it doesn&#8217;t install a system service of its own, and we&#8217;ll need to figure that out. First, let&#8217;s install the package:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ snap install syncthing\n$ snap connect syncthing:home :home\n$ snap run syncthing<\/pre>\n\n\n\n<p>Once you&#8217;re satisfied, you can stop syncthing. That isn&#8217;t very useful yet, but we needed to run it once to create a configuration file.<\/p>\n\n\n\n<p>So, first, we need to give syncthing a place to put its data, replacing &#8220;USERNAME&#8221; with your system username:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo mkdir \/media\/data1\/syncthing\n$ sudo chown <em>USERNAME<\/em>:<em>USERNAME<\/em> \/media\/data1\/syncthing<\/pre>\n\n\n\n<p>Unfortunately, you&#8217;ll find that the syncthing application doesn&#8217;t have access to \/media\/data1, and its snap doesn&#8217;t support the removable-media interface, so it&#8217;s limited to your home folder. But that&#8217;s okay, we can solve this by creating a bind mount. Let&#8217;s create a mount unit in <em>\/writable\/system-data\/etc\/systemd\/system\/home-USERNAME-syncthing.mount<\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Unit]\nDescription=Mount unit for <em>USERNAME<\/em>-syncthing\n\n[Mount]\nWhat=\/media\/data1\/syncthing\/<em>USERNAME<\/em>\nWhere=\/home\/<em>USERNAME<\/em>\/syncthing\nType=none\nOptions=bind\n\n[Install]\nWantedBy=multi-user.target<\/pre>\n\n\n\n<p>(If you&#8217;re wondering, yes, systemd figures out that it needs to mount media-data1 before it can create this bind mount, so don&#8217;t worry about that).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo systemctl daemon-reload\n$ sudo systemctl start home-<em>USERNAME<\/em>-syncthing.mount\n$ sudo systemctl enable home-<em>USERNAME<\/em>-syncthing.mount<\/pre>\n\n\n\n<p>Now update Syncthing&#8217;s configuration and tell it to put all of its shared folders in that directory. Open <em>\/home\/USERNAME\/snap\/syncthing\/common\/syncthing\/config.xml<\/em> in your favourite editor, and make sure you have something like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;configuration version=\"27\"&gt;\n  &lt;folder id=\"default\" label=\"Default Folder\" <strong>path=\"\/home\/<em>USERNAME<\/em>\/syncthing\/Sync\"<\/strong> type=\"readwrite\" rescanIntervalS=\"60\" fsWatcherEnabled=\"false\" fsWatcherDelayS=\"10\" ignorePerms=\"false\" autoNormalize=\"true\"&gt;\n    \u2026\n  &lt;\/folder&gt;\n  &lt;device id=\"\u2026\" name=\"<em><strong>core.example.com<\/strong><\/em>\" compression=\"metadata\" introducer=\"false\" skipIntroductionRemovals=\"false\" introducedBy=\"\"&gt;\n    &lt;address&gt;dynamic&lt;\/address&gt;\n    &lt;paused&gt;false&lt;\/paused&gt;\n    &lt;autoAcceptFolders&gt;false&lt;\/autoAcceptFolders&gt;\n  &lt;\/device&gt;\n  &lt;gui enabled=\"true\" tls=\"false\" debugging=\"false\"&gt;\n    &lt;address&gt;<strong>192.168.1.2:8384<\/strong>&lt;\/address&gt;\n    \u2026\n  &lt;\/gui&gt;\n  &lt;options&gt;\n    &lt;defaultFolderPath&gt;<strong>\/home\/<em>USERNAME<\/em>\/syncthing<\/strong>&lt;\/defaultFolderPath&gt;\n  &lt;\/options&gt;\n&lt;\/configuration&gt;<\/pre>\n\n\n\n<p>With those changes, Syncthing will create new folders inside&nbsp;<em>\/home\/USERNAME\/syncthing<\/em>, you can move the default &#8220;Sync&#8221; folder there as well, and its web interface will be accessible over your local network at <em>http:\/\/192.168.1.2:8384<\/em>. (I&#8217;m not enabling TLS here, for two reasons: it&#8217;s just the local network, and Nextcloud enables HSTS for the <em>core.example.com<\/em> domain, so things get confusing when you try to access it like that).<\/p>\n\n\n\n<p>You can try <code>snap run syncthing<\/code> again, just to be sure.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-7 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"350\" data-attachment-id=\"9116\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-2018-5-5-core-example-com-syncthing\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-core-example-com-Syncthing.png?fit=1299%2C865&amp;ssl=1\" data-orig-size=\"1299,865\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Syncthing web dashboard\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Syncthing&amp;#8217;s web dashboard from core.example.com.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-core-example-com-Syncthing.png?fit=300%2C200&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-core-example-com-Syncthing.png?fit=525%2C349&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-core-example-com-Syncthing.png?resize=525%2C350&#038;ssl=1\" alt=\"\" data-id=\"9116\" class=\"wp-image-9116\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-core-example-com-Syncthing.png?w=1299&amp;ssl=1 1299w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-core-example-com-Syncthing.png?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-core-example-com-Syncthing.png?resize=768%2C511&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-core-example-com-Syncthing.png?resize=750%2C499&amp;ssl=1 750w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-core-example-com-Syncthing.png?w=1050&amp;ssl=1 1050w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>Now we need to add a service file so Syncthing runs automatically. We could create a service that has the User field filled in and it always runs as a certain user, but for this type of service it doesn&#8217;t hurt to set it up as a <a href=\"https:\/\/fedoramagazine.org\/systemd-template-unit-files\/\">template unit<\/a>. Happily, <a href=\"https:\/\/docs.syncthing.net\/users\/autostart.html#using-systemd\">Syncthing&#8217;s documentation<\/a> provides a unit file we can borrow, so we don&#8217;t need to do much thinking here. You&#8217;ll need to create a file called <em>\/writable\/system-data\/etc\/systemd\/system\/syncthing@.service<\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Unit]\nDescription=Syncthing - Open Source Continuous File Synchronization for %I\nDocumentation=man:syncthing(1)\nAfter=network.target\n\n[Service]\nUser=%i\nExecStart=\/usr\/bin\/snap run syncthing -no-browser -logflags=0\nRestart=on-failure\nSuccessExitStatus=3 4\nRestartForceExitStatus=3 4\n\n[Install]\nWantedBy=multi-user.target<\/pre>\n\n\n\n<p>Note that our <em>Exec<\/em> line is a little different than theirs, since we need it to run <em>syncthing<\/em> under the <em>snap<\/em> program.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo systemctl daemon-reload\n$ sudo systemctl start syncthing@<em>USERNAME<\/em>.service\n$ sudo systemctl enable syncthing@<em>USERNAME<\/em>.service<\/pre>\n\n\n\n<p>And there you have it, we have Syncthing! The web interface for the Ubuntu Core system is only accessible over your local network, but assuming you forwarded port 22000 on your router earlier, you should be able to sync with it from anywhere.<\/p>\n\n\n\n<p>If you install the Syncthing desktop client (<code>snap install syncthing<\/code> in Ubuntu, <code>dnf install syncthing-gtk<\/code> in Fedora), you&#8217;ll be able to connect your other devices to each other. On each device that you connect to this one, make sure you set <em>core.example.com<\/em> as an <em>Introducer<\/em>. That way they will discover each other through it, which saves a bit of time.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-8 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"388\" data-attachment-id=\"9115\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-from-2018-05-04-23-04-30\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-04-30.png?fit=947%2C700&amp;ssl=1\" data-orig-size=\"947,700\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Syncthing-GTK\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Syncthing&amp;#8217;s desktop client on another device.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-04-30.png?fit=300%2C222&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-04-30.png?fit=525%2C388&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-04-30.png?resize=525%2C388&#038;ssl=1\" alt=\"\" data-id=\"9115\" class=\"wp-image-9115\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-04-30.png?w=947&amp;ssl=1 947w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-04-30.png?resize=300%2C222&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-04-30.png?resize=768%2C568&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-04-30.png?resize=750%2C554&amp;ssl=1 750w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>Once your devices are all connected, it&#8217;s a good idea to go to Syncthing&#8217;s web interface at&nbsp;<em>http:\/\/192.168.1.2:8384<\/em> and edit the settings for each device. You can enable &#8220;Auto Accept&#8221; so whenever a device shares a new folder with <em>core.example.com<\/em>, it will be accepted automatically.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Nextcloud + Syncthing<\/h3>\n\n\n\n<p>There is one last thing I did here. Syncthing and Nextcloud have some overlap, but I found myself using them for pretty different sorts of tasks. I use Nextcloud for media files and archives that I want to store on a single big hard drive, and occasionally stream over the network; and I use Syncthing for files that I want to have locally on every device.<\/p>\n\n\n\n<p>Still, it would be nice if I could have Nextcloud&#8217;s web UI and sharing options with Syncthing&#8217;s files. In theory we could bind mount Syncthing&#8217;s data directory into Nextcloud&#8217;s data directory, but the Nextcloud and Syncthing services run as different users. So, that probably won&#8217;t go particularly well.<\/p>\n\n\n\n<p>Instead, it works quite well to mount Syncthing&#8217;s data directory using SSH.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-3 is-cropped wp-block-gallery-9 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"308\" data-attachment-id=\"9015\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-2018-4-28-apps-nextcloud\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Apps-Nextcloud.png?fit=1316%2C771&amp;ssl=1\" data-orig-size=\"1316,771\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Nextcloud &amp;#8211; Apps\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Nextcloud: Apps \/ External storage support.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Apps-Nextcloud.png?fit=300%2C176&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Apps-Nextcloud.png?fit=525%2C307&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Apps-Nextcloud.png?resize=525%2C308&#038;ssl=1\" alt=\"\" data-id=\"9015\" class=\"wp-image-9015\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Apps-Nextcloud.png?w=1316&amp;ssl=1 1316w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Apps-Nextcloud.png?resize=300%2C176&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Apps-Nextcloud.png?resize=768%2C450&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Apps-Nextcloud.png?resize=750%2C439&amp;ssl=1 750w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Apps-Nextcloud.png?w=1050&amp;ssl=1 1050w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"179\" data-attachment-id=\"9016\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-2018-4-28-admin-nextcloud\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Admin-Nextcloud.png?fit=1316%2C449&amp;ssl=1\" data-orig-size=\"1316,449\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Nextcloud &amp;#8211; Admin\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Nextcloud: Admin \/ External storages.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Admin-Nextcloud.png?fit=300%2C102&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Admin-Nextcloud.png?fit=525%2C179&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Admin-Nextcloud.png?resize=525%2C179&#038;ssl=1\" alt=\"\" data-id=\"9016\" class=\"wp-image-9016\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Admin-Nextcloud.png?w=1316&amp;ssl=1 1316w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Admin-Nextcloud.png?resize=300%2C102&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Admin-Nextcloud.png?resize=768%2C262&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Admin-Nextcloud.png?resize=750%2C256&amp;ssl=1 750w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-4-28-Admin-Nextcloud.png?w=1050&amp;ssl=1 1050w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"151\" data-attachment-id=\"9126\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-2018-5-5-personal-nextcloud\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Personal-Nextcloud.png?fit=1385%2C398&amp;ssl=1\" data-orig-size=\"1385,398\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Nextcloud &amp;#8211; Personal\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Nextcloud: Personal \/ External storages.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Personal-Nextcloud.png?fit=300%2C86&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Personal-Nextcloud.png?fit=525%2C151&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Personal-Nextcloud.png?resize=525%2C151&#038;ssl=1\" alt=\"\" data-id=\"9126\" class=\"wp-image-9126\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Personal-Nextcloud.png?w=1385&amp;ssl=1 1385w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Personal-Nextcloud.png?resize=300%2C86&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Personal-Nextcloud.png?resize=768%2C221&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Personal-Nextcloud.png?resize=750%2C216&amp;ssl=1 750w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-5-Personal-Nextcloud.png?w=1050&amp;ssl=1 1050w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>First, in Nextcloud, go to the Apps section and enable the &#8220;External storage support&#8221; app.<\/p>\n\n\n\n<p>Now you need to go to Admin, and &#8220;External storages&#8221;, and allow users to mount external storage.<\/p>\n\n\n\n<p>Finally, go to your Personal settings, choose &#8220;External storages&#8221;, add a folder named Syncthing, and tell it connect over SFTP. Give it the hostname of the system that has Syncthing (so, <em>core.example.com<\/em>), the username for the user that is running Syncthing (<em>USERNAME<\/em>), and the path to Syncthing&#8217;s data files (\/home\/USERNAME\/syncthing). It will need an SSH key pair to authenticate.<\/p>\n\n\n\n<p>When you click <em>Generate keys<\/em> it will create a key pair. You will need to copy and paste the public key (which appears in the text field) to <em>\/home\/USERNAME\/.ssh\/authorized_keys<\/em>.<\/p>\n\n\n\n<p>If you try the gear icon to the right, you&#8217;ll find an option to enable sharing for the external storage, which is very useful here. Now you can use Nextcloud to view, share, or edit your files from Syncthing.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-10 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"340\" data-attachment-id=\"9097\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-2018-5-3-example-files-nextcloud\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-3-Example-Files-Nextcloud.png?fit=1325%2C858&amp;ssl=1\" data-orig-size=\"1325,858\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Nextcloud &amp;#8211; Files\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;You can edit files from Syncthing in Nextcloud\u2026&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-3-Example-Files-Nextcloud.png?fit=300%2C194&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-3-Example-Files-Nextcloud.png?fit=525%2C340&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-3-Example-Files-Nextcloud.png?resize=525%2C340&#038;ssl=1\" alt=\"\" data-id=\"9097\" class=\"wp-image-9097\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-3-Example-Files-Nextcloud.png?w=1325&amp;ssl=1 1325w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-3-Example-Files-Nextcloud.png?resize=300%2C194&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-3-Example-Files-Nextcloud.png?resize=768%2C497&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-3-Example-Files-Nextcloud.png?resize=750%2C486&amp;ssl=1 750w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-2018-5-3-Example-Files-Nextcloud.png?w=1050&amp;ssl=1 1050w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"382\" data-attachment-id=\"9114\" data-permalink=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/screenshot-from-2018-05-04-23-09-04\/\" data-orig-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-09-04.png?fit=1218%2C887&amp;ssl=1\" data-orig-size=\"1218,887\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"GNOME Files showing a synced folder\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;\u2026 and they&amp;#8217;ll sync with your devices via Syncthing.&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-09-04.png?fit=300%2C218&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-09-04.png?fit=525%2C382&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-09-04.png?resize=525%2C382&#038;ssl=1\" alt=\"\" data-id=\"9114\" class=\"wp-image-9114\" srcset=\"https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-09-04.png?w=1218&amp;ssl=1 1218w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-09-04.png?resize=300%2C218&amp;ssl=1 300w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-09-04.png?resize=768%2C559&amp;ssl=1 768w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-09-04.png?resize=750%2C546&amp;ssl=1 750w, https:\/\/i0.wp.com\/dylanmc.ca\/wp-content\/uploads\/Screenshot-from-2018-05-04-23-09-04.png?w=1050&amp;ssl=1 1050w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Backups<\/h3>\n\n\n\n<p>I spun tires for a while with backups, but eventually I settled on <a href=\"https:\/\/restic.net\/\">Restic<\/a>. It is fast, efficient, and encrypted. I&#8217;m really impressed with it.<\/p>\n\n\n\n<p>Unfortunately, the snap for Restic doesn&#8217;t support strict confinement, which means it won&#8217;t work on Ubuntu Core.&nbsp; So I cheated. Let&#8217;s set this up under the root user.<\/p>\n\n\n\n<p>You can find <a href=\"https:\/\/github.com\/restic\/restic\/releases\">releases of Restic<\/a> as prebuilt binaries. We&#8217;ll also need to install a snap that includes curl. (Or you can download the file on another system and transfer it with scp, but this blog post is too long already).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ snap install demo-curl\n$ snap run demo-curl.curl -L \"https:\/\/github.com\/restic\/restic\/releases\/download\/v0.8.3\/restic_0.8.3_linux_amd64.bz2\" | bunzip2 &gt; restic\n$ chmod +x restic\n$ sudo mkdir \/root\/bin\n$ sudo cp restic \/root\/bin<\/pre>\n\n\n\n<p>We need to figure out <a href=\"https:\/\/restic.readthedocs.io\/en\/stable\/030_preparing_a_new_repo.html\">the environment variables<\/a> we want for Restic. That depends on what kind of storage service you&#8217;re using. I created a file with those variables at <em>\/root\/restic-MYACCOUNT.env<\/em>. For <a href=\"https:\/\/www.backblaze.com\/\">Backblaze B2<\/a>, mine looked like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/sh\n\nexport RESTIC_REPOSITORY=\"<em>b2:core-example-com--1<\/em>\"\nexport B2_ACCOUNT_ID=\"\u2026\"\nexport B2_ACCOUNT_KEY=\"\u2026\"\nexport RESTIC_PASSWORD=\"\u2026\"<\/pre>\n\n\n\n<p>Next, make a list of the files you&#8217;d like to back up in <em>\/root\/backup-files.txt<\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/media\/data1\/nextcloud\/data\/<em>USERNAME<\/em>\/files\n\/media\/data1\/syncthing\/<em>USERNAME<\/em>\n\/writable\/system-data\/<\/pre>\n\n\n\n<p>I added a couple of quick little helper scripts to handle the most common things you&#8217;ll be doing with Restic:<\/p>\n\n\n\n<p><strong>\/root\/bin\/restic-<em>MYACCOUNT<\/em>.sh<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/sh\n\n. \/root\/restic-<em>MYACCOUNT<\/em>.env\n\/root\/bin\/restic $@<\/pre>\n\n\n\n<p>Use this as a shortcut to run restic with the correct environment variables.<\/p>\n\n\n\n<p><strong>\/root\/bin\/backups-push.sh<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/sh\n\nRESTIC=\"\/root\/bin\/restic-<em>MYACCOUNT<\/em>.sh\"\nRESTIC_ARGS=\"--cache-dir \/root\/.cache\/restic\"\n\n${RESTIC} ${RESTIC_ARGS} backup --files-from \/root\/backup-files.txt --exclude \".stversions\" --exclude-if-present \".backup-ignore\" --exclude-caches<\/pre>\n\n\n\n<p>This will ignore any directory that contains a file named &#8220;.backup-ignore&#8221;. (So to stop a directory from being backed up, you can run <code>touch <em>\/path\/to\/the\/directory\/<\/em>.backup-ignore<\/code>). This is a great way to save time if you have some big directories that don&#8217;t really need to be backed up, like a directory full of, um,&nbsp; Linux ISOs <em>shifty eyes<\/em>.<\/p>\n\n\n\n<p><strong>\/root\/bin\/backups-clean.sh<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/sh\n\nRESTIC=\"\/root\/bin\/restic-<em>MYACCOUNT<\/em>.sh\"\nRESTIC_ARGS=\"--cache-dir \/root\/.cache\/restic\"\n\n${RESTIC} ${RESTIC_ARGS} forget --keep-daily 7 --keep-weekly 8 --keep-monthly 12 --prune\n${RESTIC} ${RESTIC_ARGS} check<\/pre>\n\n\n\n<p>This will periodically remove old snapshots, prune unused blocks, and then check for errors.<\/p>\n\n\n\n<p>Make sure all of those scripts are executable:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo chmod +x \/root\/bin\/restic-<em>MYACCOUNT<\/em>.sh\n$ sudo chmod +x \/root\/bin\/restic-push.sh\n$ sudo chmod +x \/root\/bin\/restic-clean.sh<\/pre>\n\n\n\n<p>We still need to add systemd stuff, but let&#8217;s try this thing first!<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo \/root\/bin\/restic-<em>MYACCOUNT<\/em>.sh init\n$ sudo \/root\/bin\/backups-push.sh\n$ sudo \/root\/bin\/restic-<em>MYACCOUNT<\/em>.sh snapshots<\/pre>\n\n\n\n<p>Have fun playing with Restic, try restoring some files, note that you can list all the files in a snapshot and restore specific ones. It&#8217;s a really nice little backup tool.<\/p>\n\n\n\n<p>It&#8217;s pretty easy to get systemd helping here as well. First let&#8217;s add our service file. This is a different kind of system service because it isn&#8217;t a daemon. Instead, it is a oneshot service. We&#8217;ll save it as <em>\/writable\/system-data\/etc\/systemd\/system\/backups-task.service<\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Unit]\nDescription=Regular system backups with Restic\n\n[Service]\nType=oneshot\nExecStart=\/bin\/sh \/root\/bin\/backups-push.sh\nExecStart=\/bin\/sh \/root\/bin\/backups-clean.sh<\/pre>\n\n\n\n<p>Now we need to schedule it to run on a regular basis. Let&#8217;s create <a href=\"https:\/\/www.freedesktop.org\/software\/systemd\/man\/systemd.timer.html\">a systemd timer unit<\/a> for that: <em>\/writable\/system-data\/etc\/systemd\/system\/backups-task.timer<\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Unit]\nDescription=Run backups-task daily\n\n[Timer]\nOnCalendar=09:00 UTC \nPersistent=true\n\n[Install]\nWantedBy=timers.target<\/pre>\n\n\n\n<p>One gotcha to notice here: with newer versions of systemd, you can use time zones like PDT or America\/Vancouver for the <em>OnCalendar<\/em> entry, and you can test how that will work using systemd-analyze, like <code>systemd-analyze calendar \"09:00 America\/Vancouver\"<\/code>. Alas, that is not the case in Ubuntu Core 16, so you&#8217;ll probably have the best luck using UTC and calculating timezones yourself.<\/p>\n\n\n\n<p>Now that you have your timer and your service, you can test the service by starting it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo systemctl start backups-task.service\n$ sudo systemctl status backups-task.service<\/pre>\n\n\n\n<p>If all goes well, enable the timer:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo systemctl start backups-task.timer\n$ sudo systemctl enable backups-task-timer<\/pre>\n\n\n\n<p>To see your timer, you can use systemctl list-timers:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo systemctl list-timers\n\u2026\nSat 2018-04-28 09:00:00 UTC 3h 30min left Fri 2018-04-27 09:00:36 UTC 20h ago backups-task.timer backups-task.service\n\u2026<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Some notes on security<\/h3>\n\n\n\n<p>Some people (understandably) dislike running this kind of web service on port 80. Nextcloud&#8217;s Apache instance runs on port 80 and port 443 by default, but you can change that using <code>snap set nextcloud ports.http=<em>80<\/em> ports.https=<em>443<\/em><\/code>.&nbsp; However, you may need to generate a self-signed SSL certificate in that case.<\/p>\n\n\n\n<p>Nextcloud (like any daemon installed by Snappy) runs as root, but, as a snap, it is confined to a subset of the system. There is some official documentation about <a href=\"https:\/\/docs.ubuntu.com\/core\/en\/guides\/intro\/security\">security and sandboxing in Ubuntu Core<\/a> if you are interested. You can always run <code>sudo snap run --shell nextcloud.occ<\/code> to get an idea of what it has access to.<\/p>\n\n\n\n<p>If you feel paranoid about how we gave Nextcloud access to <em>all<\/em> removable media, you can create a bind mount from <em>\/writable\/system-data\/var\/snap\/nextcloud\/common\/nextcloud<\/em> to <em>\/media\/data1\/nextcloud<\/em>, like we did for Syncthing, and <code>snap disconnect nextcloud:removable-media<\/code>. Now it only has access to those files on the other end of the bind mount.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>So that&#8217;s everything!<\/p>\n\n\n\n<p>This definitely isn&#8217;t a tiny amount of setup. It took an afternoon. (And it&#8217;ll probably take two or three years to pay for itself). But I&#8217;m impressed by how smoothly it all went, and with a few exceptions where I was nudged into loopy workarounds,&nbsp; it feels simple and reproducible. If you&#8217;re looking at hosting more of your own files, I would happily recommend something like this.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My annual Dropbox renewal date was coming up, and I thought to myself &#8220;I&#8217;m working with servers all the time. I shouldn&#8217;t need to pay someone else for this.&#8221; I was also knee deep in a math course, so I felt like procrastinating.<\/p>\n<p>I&#8217;m really happy with the result, so I thought I would explain it for anyone else who wants to do the same. Here&#8217;s what I was aiming for:<\/p>\n<ul class=\"wp-block-list\">\n<li>Safe, convenient archiving for big files.<\/li>\n<li>Instant sync between devices for stuff I&#8217;m working on.<\/li>\n<li>Access over LAN from home, and over the Internet from anywhere else.<\/li>\n<li>Regular, encrypted offsite backups.<\/li>\n<li>Compact, low power hardware that I can stick in a closet and forget about.<\/li>\n<li>Some semblance of security, at least so a compromised service won&#8217;t put the rest of the system at risk&hellip;<\/li>\n<\/ul>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"federate","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-8980","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>My tiny file server with Ubuntu Core, Nextcloud and Syncthing - Dylan McCall<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"My tiny file server with Ubuntu Core, Nextcloud and Syncthing - Dylan McCall\" \/>\n<meta property=\"og:description\" content=\"My annual Dropbox renewal date was coming up, and I thought to myself &#8220;I&#8217;m working with servers all the time. I shouldn&#8217;t need to pay someone else for this.&#8221; I was also knee deep in a math course, so I felt like procrastinating.  I&#8217;m really happy with the result, so I thought I would explain it for anyone else who wants to do the same. Here&#8217;s what I was aiming for:  Safe, convenient archiving for big files.Instant sync between devices for stuff I&#8217;m working on.Access over LAN from home, and over the Internet from anywhere else.Regular, encrypted offsite backups.Compact, low power hardware that I can stick in a closet and forget about.Some semblance of security, at least so a compromised service won&#8217;t put the rest of the system at risk&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/\" \/>\n<meta property=\"og:site_name\" content=\"Dylan McCall\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-06T04:38:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-20T18:23:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg\" \/>\n<meta name=\"author\" content=\"Dylan McCall\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dylan McCall\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/\"},\"author\":{\"name\":\"Dylan McCall\",\"@id\":\"https:\/\/dylanmc.ca\/\/-\/#\/schema\/person\/c244419a779c5414c768bc53ac5fb2d5\"},\"headline\":\"My tiny file server with Ubuntu Core, Nextcloud and Syncthing\",\"datePublished\":\"2018-05-06T04:38:27+00:00\",\"dateModified\":\"2024-08-20T18:23:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/\"},\"wordCount\":3016,\"image\":{\"@id\":\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg\",\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/\",\"url\":\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/\",\"name\":\"My tiny file server with Ubuntu Core, Nextcloud and Syncthing - Dylan McCall\",\"isPartOf\":{\"@id\":\"https:\/\/dylanmc.ca\/\/-\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg\",\"datePublished\":\"2018-05-06T04:38:27+00:00\",\"dateModified\":\"2024-08-20T18:23:22+00:00\",\"author\":{\"@id\":\"https:\/\/dylanmc.ca\/\/-\/#\/schema\/person\/c244419a779c5414c768bc53ac5fb2d5\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/#primaryimage\",\"url\":\"https:\/\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg\",\"contentUrl\":\"https:\/\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg\"},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dylanmc.ca\/\/-\/#website\",\"url\":\"https:\/\/dylanmc.ca\/\/-\/\",\"name\":\"Dylan McCall\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dylanmc.ca\/\/-\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/dylanmc.ca\/\/-\/#\/schema\/person\/c244419a779c5414c768bc53ac5fb2d5\",\"name\":\"Dylan McCall\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dylanmc.ca\/\/-\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c94ab3a7e6a884542205e0408711cd54bb1fd5f4e90e7a5f621a54656a18a037?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c94ab3a7e6a884542205e0408711cd54bb1fd5f4e90e7a5f621a54656a18a037?s=96&d=mm&r=g\",\"caption\":\"Dylan McCall\"},\"description\":\"Software developer, tea drinker, GNOME contributor. Occasionally a raving fanatic.\",\"sameAs\":[\"https:\/\/dylanmc.ca\/\/-\"],\"url\":\"https:\/\/dylanmc.ca\/\/-\/blog\/author\/dylan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"My tiny file server with Ubuntu Core, Nextcloud and Syncthing - Dylan McCall","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/","og_locale":"en_US","og_type":"article","og_title":"My tiny file server with Ubuntu Core, Nextcloud and Syncthing - Dylan McCall","og_description":"My annual Dropbox renewal date was coming up, and I thought to myself &#8220;I&#8217;m working with servers all the time. I shouldn&#8217;t need to pay someone else for this.&#8221; I was also knee deep in a math course, so I felt like procrastinating.  I&#8217;m really happy with the result, so I thought I would explain it for anyone else who wants to do the same. Here&#8217;s what I was aiming for:  Safe, convenient archiving for big files.Instant sync between devices for stuff I&#8217;m working on.Access over LAN from home, and over the Internet from anywhere else.Regular, encrypted offsite backups.Compact, low power hardware that I can stick in a closet and forget about.Some semblance of security, at least so a compromised service won&#8217;t put the rest of the system at risk&hellip;","og_url":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/","og_site_name":"Dylan McCall","article_published_time":"2018-05-06T04:38:27+00:00","article_modified_time":"2024-08-20T18:23:22+00:00","og_image":[{"url":"https:\/\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg","type":"","width":"","height":""}],"author":"Dylan McCall","twitter_misc":{"Written by":"Dylan McCall","Est. reading time":"18 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/#article","isPartOf":{"@id":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/"},"author":{"name":"Dylan McCall","@id":"https:\/\/dylanmc.ca\/\/-\/#\/schema\/person\/c244419a779c5414c768bc53ac5fb2d5"},"headline":"My tiny file server with Ubuntu Core, Nextcloud and Syncthing","datePublished":"2018-05-06T04:38:27+00:00","dateModified":"2024-08-20T18:23:22+00:00","mainEntityOfPage":{"@id":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/"},"wordCount":3016,"image":{"@id":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/#primaryimage"},"thumbnailUrl":"https:\/\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg","inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/","url":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/","name":"My tiny file server with Ubuntu Core, Nextcloud and Syncthing - Dylan McCall","isPartOf":{"@id":"https:\/\/dylanmc.ca\/\/-\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/#primaryimage"},"image":{"@id":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/#primaryimage"},"thumbnailUrl":"https:\/\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg","datePublished":"2018-05-06T04:38:27+00:00","dateModified":"2024-08-20T18:23:22+00:00","author":{"@id":"https:\/\/dylanmc.ca\/\/-\/#\/schema\/person\/c244419a779c5414c768bc53ac5fb2d5"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dylanmc.ca\/\/-\/blog\/2018\/05\/05\/my-tiny-file-server-with-ubuntu-core-nextcloud-and-syncthing\/#primaryimage","url":"https:\/\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg","contentUrl":"https:\/\/dylanmc.ca\/wp-content\/uploads\/IMG_20180428_013430.jpg"},{"@type":"WebSite","@id":"https:\/\/dylanmc.ca\/\/-\/#website","url":"https:\/\/dylanmc.ca\/\/-\/","name":"Dylan McCall","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dylanmc.ca\/\/-\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/dylanmc.ca\/\/-\/#\/schema\/person\/c244419a779c5414c768bc53ac5fb2d5","name":"Dylan McCall","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dylanmc.ca\/\/-\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c94ab3a7e6a884542205e0408711cd54bb1fd5f4e90e7a5f621a54656a18a037?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c94ab3a7e6a884542205e0408711cd54bb1fd5f4e90e7a5f621a54656a18a037?s=96&d=mm&r=g","caption":"Dylan McCall"},"description":"Software developer, tea drinker, GNOME contributor. Occasionally a raving fanatic.","sameAs":["https:\/\/dylanmc.ca\/\/-"],"url":"https:\/\/dylanmc.ca\/\/-\/blog\/author\/dylan\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pcXOQX-2kQ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dylanmc.ca\/\/-\/wp-json\/wp\/v2\/posts\/8980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dylanmc.ca\/\/-\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dylanmc.ca\/\/-\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dylanmc.ca\/\/-\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dylanmc.ca\/\/-\/wp-json\/wp\/v2\/comments?post=8980"}],"version-history":[{"count":91,"href":"https:\/\/dylanmc.ca\/\/-\/wp-json\/wp\/v2\/posts\/8980\/revisions"}],"predecessor-version":[{"id":11195,"href":"https:\/\/dylanmc.ca\/\/-\/wp-json\/wp\/v2\/posts\/8980\/revisions\/11195"}],"wp:attachment":[{"href":"https:\/\/dylanmc.ca\/\/-\/wp-json\/wp\/v2\/media?parent=8980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dylanmc.ca\/\/-\/wp-json\/wp\/v2\/categories?post=8980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dylanmc.ca\/\/-\/wp-json\/wp\/v2\/tags?post=8980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}