This repository has been archived on 2025-02-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
swift-mhoush.com/deploy/articles/2024/unvr-as-nas/index.html

227 lines
11 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8"/>
<meta content="#0e1112" media="(prefers-color-scheme: dark)" name="theme-color"/>
<meta content="#566B78" media="(prefers-color-scheme: light)" name="theme-color"/>
<meta content="Michael Housh" name="author"/>
<meta content="Mhoush" name="apple-mobile-web-app-title"/>
<meta content="initial-scale=1.0, width=device-width" name="viewport"/>
<meta content="telephone=no" name="format-detection"/>
<meta content="True" name="HandheldFriendly"/>
<meta content="320" name="MobileOptimized"/>
<meta content="Mhoush" name="og:site_name"/>
<meta content="hvac, developer, swift, home-performance, design" name="keywords"/>
<title>
mhoush: UNVR as NAS
</title>
<link href="/static/favicon.ico" rel="shortcut icon"/>
<link href="/static/output.css" rel="stylesheet"/>
<link href="/static/style.css" rel="stylesheet"/>
<link href="/articles/feed.xml" rel="alternate" title="mhoush" type="application/rss+xml"/>
<link href="/static/prism.css" rel="stylesheet"/>
<meta content="In this post, Im going to show how to setup a Samba server on a Ubiquity UNVR so that it can be
used as NAS (network attached storage). Be aware that this should be done with caution and may void
any warranty on your UNVR as we are using it for..." name="description"/>
<meta content="summary_large_image" name="twitter:card"/>
<meta content="http://localhost:3000/articles/images/2024-03-15-unvr-as-nas.png" name="twitter:image"/>
<meta content="UNVR as NAS" name="twitter:image:alt"/>
<meta content="http://localhost:3000/articles/images//articles/2024/unvr-as-nas/" name="og:url"/>
<meta content="UNVR as NAS" name="og:title"/>
<meta content="In this post, Im going to show how to setup a Samba server on a Ubiquity UNVR so that it can be
used as NAS (network attached storage). Be aware that this should be done with caution and may void
any warranty on your UNVR as we are using it for..." name="og:description"/>
<meta content="http://localhost:3000/articles/images/2024-03-15-unvr-as-nas.png" name="og:image"/>
<meta content="1014" name="og:image:width"/>
<meta content="530" name="og:image:height"/>
<script crossorigin="anonymous" src="https://kit.fontawesome.com/f209982030.js">
</script>
</head>
<body class="bg-page text-white pb-5 font-avenir articles">
<header class="bg-nav text-gray py-4 text-base/6 lg:fixed w-full lg:h-[62px]">
<nav class="container flex gap-x-5 lg:gap-x-y items-center">
<ul class="flex flex-wrap gap-x-2 lg:gap-x-5">
<li>
<a class href="/">Home</a>
</li>
<li>
<a class="active" href="/articles/">Articles</a>
</li>
<li>
<a class href="/about/">About</a>
</li>
</ul>
</nav>
</header>
<div class="container pt-12 lg:pt-28">
<article class="prose">
<h1>
UNVR as NAS
</h1>
<div class="-mt-6">
<div class="text-gray gray-links text-sm">
<span class="border-r border-gray pr-2 mr-2">March 15, 2024</span>634 words, posted in <a href="/articles/tag/how-to/">how-to</a>, <a href="/articles/tag/nas/">nas</a>, <a href="/articles/tag/networking/">networking</a> and <a href="/articles/tag/programming/">programming</a>
</div>
</div>
<img alt="banner" src="http://localhost:3000/articles/images/2024-03-15-unvr-as-nas.png"/>
<p>In this post, Im going to show how to setup a Samba server on a Ubiquity UNVR so that it can be
used as NAS (network attached storage). Be aware that this should be done with caution and may void
any warranty on your UNVR as we are using it for purposes beyond its original intent. Its also
possible that this setup will break when / if updating the UNVR software. With that said, lets jump
in.</p>
<p>This post follows along with
<a href="https://www.reddit.com/r/Ubiquiti/comments/11o7v8l/how_to_use_the_unvr_as_a_nas_instructions/">this reddit post</a>,
with some adaptations to get it to work on the latest Unifi-OS release of <code>3.2.12</code>.</p>
<h2>Step One - Setup SSH &amp; Login</h2>
<p>In your unifi network console you need to enable the <code>SSH</code> login option and set a secure password
for the root user to login to the UNVR.</p>
<p><img src="/articles/images/2024-03-15-ssh.png" alt="ssh.png" /></p>
<p>Once that is complete you can login to your UNVR using your terminal and the IP address of your UNVR
on your network.</p>
<p><code>ssh root@192.168.1.10</code></p>
<h2>Step Two - Install Samba</h2>
<p>First, well update the package registry information.</p>
<p><code>apt-get update</code></p>
<p>Next, install samba.</p>
<p><code>apt-get install samba</code></p>
<h2>Step Three - Setup Samba</h2>
<p>In order to edit the configuration we are going to need to install your terminal based text editor
of choice (generally nano or vim), for me I will install vim.</p>
<p><code>apt-get install vim</code></p>
<p>Create a backup of the default configuration.</p>
<p><code>cp /etc/samba/smb.conf /etc/samba/smb.conf.bak</code></p>
<p>Open the configuration file to be edited.</p>
<p><code>vim /etc/samba/smb.conf</code></p>
<p>Just above the <code>Share Definitions</code> section of the configuration, I added some global settings to
make the samba server act better for time machine backups.</p>
<pre><code>#======================= MacOS Client Optimizations =======================
vfs objects = fruit streams_xattr
fruit:metadata = stream
fruit:model = MacSamba
fruit:posix_rename = yes
fruit:veto_appledouble = no
fruit:nfs_aces = no
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes
</code></pre>
<p>Also because we want users we create to be able to read and write to their home directories created
on the samba server, we need to change the option under the <code>[homes]</code> share definition to be
<code>read only = no</code>.</p>
<p>That is our primary configuration. You can add more share definitions at the bottom of the file to
suit your use case, there are decent examples of this in the original reddit post, linked in the
beginning.</p>
<p>Save and exit the file.</p>
<p><code>:wq</code></p>
<h2>Step Four - Start Samba</h2>
<p>Use the following command to start the samba server.</p>
<p><code>sudo service smbd start</code></p>
<p>You can check the status, by running the following command.</p>
<p><code>systemctl status smbd</code></p>
<p><img src="/articles/images/2024-03-15-status.png" alt="status" /></p>
<p>Enable the samba server to start on boot.</p>
<p><code>systemctl enable smbd.service</code></p>
<h2>Step Five - Create Users</h2>
<p>Create a user with a home directory that they can use.</p>
<p><code>useradd --create-home michael</code></p>
<p>Give the user a password to login to the samba server.</p>
<p><code>smbpasswd michael</code></p>
<h2>Step Six - Login to Samba Server from Client</h2>
<p>In the <code>Finder</code> app on macOS you can type <code>⌘k</code> to connect to a server.</p>
<p>In the text field enter <code>smb://&lt;USER&gt;@&lt;UNVR_IP&gt;</code> to connect to the samba server.</p>
<p><img src="/articles/images/2024-03-15-connect.png" alt="connect" /></p>
<p>You can also automatically connect to the server when you login to your client device, for this to
work you need the credentials to be stored in your keychain (ticking the box in the step above when
you first connect to the server).</p>
<p>This is found in <code>System Settings -&gt; General -&gt; Login Items -&gt; Open at Login</code>. Click the plus button
and select the volume you would like to mount at login.</p>
<p><img src="/articles/images/2024-03-15-login.png" alt="login" /></p>
<p>Once you have it setup so that the server is connected on login, you can also set it up as location
for Time Machine Backups. <code>System Settings -&gt; General -&gt; Time Machine</code></p>
<p><img src="/articles/images/2024-03-15-time-machine.png" alt="time-machine" /></p>
</article>
<div class="border-t border-light mt-8 pt-8">
<h2 class="text-4xl font-extrabold mb-8">
Written by
</h2>
<div class="flex flex-col lg:flex-row gap-8">
<div class="flex-[0_0_120px]">
<img class="w-[120px] h-[120px] rounded-full" src="/static/images/avatar.png"/>
</div>
<div class="prose">
<h3 class="!m-0">
Michael Housh
</h3>
<p class="text-gray">
HVAC business owner with over 27 years of experience. Writes articles about HVAC,
Programming, Home-Performance, and Building Science
</p>
</div>
</div>
</div>
<div class="mt-16">
<h2 class="text-4xl font-extrabold mb-8">
More articles
</h2>
<div class="grid lg:grid-cols-2 gap-10">
<section>
<h2 class="text-2xl font-bold mb-2">
<a class="[&:hover]:border-b border-orange" href="/articles/2025/vapor-htmx-todo-app/">Vapor + HTMX</a>
</h2>
<div class="text-gray gray-links text-sm mb-4">
<span class="border-r border-gray pr-2 mr-2">January 05, 2025</span><a href="/articles/tag/general/">general</a>, <a href="/articles/tag/programming/">programming</a> and <a href="/articles/tag/software/">software</a>
</div>
<p>
<a href="/articles/2025/vapor-htmx-todo-app/"><div>
Build an example application using Vapor and HTMX.
</div></a>
</p>
</section>
<section>
<h2 class="text-2xl font-bold mb-2">
<a class="[&:hover]:border-b border-orange" href="/articles/2024/free-as-in-freedom/">Free As In Freedom</a>
</h2>
<div class="text-gray gray-links text-sm mb-4">
<span class="border-r border-gray pr-2 mr-2">April 09, 2024</span><a href="/articles/tag/general/">general</a>, <a href="/articles/tag/open-source/">open-source</a> and <a href="/articles/tag/software/">software</a>
</div>
<p>
<a href="/articles/2024/free-as-in-freedom/"><div>
Salute to open-source software engineers
</div></a>
</p>
</section>
</div>
<p class="prose mt-8">
<a href="/articles/"> See all articles</a>
</p>
</div>
</div>
<div class="site-footer container text-gray gray-links border-t border-light text-center pt-6 mt-8 text-sm">
<p>
Copyright © Michael Housh 2023-2025.
</p>
<p>
Built in Swift using
<a href="https://github.com/loopwerk/Saga" rel="nofollow" target="_blank">Saga</a>
(<a href="https://github.com/m-housh/mhoush.com" rel="nofollow" target="_blank">source</a>).
</p>
<p>
<a href="http://localhost:3000/articles/feed.xml" rel="nofollow" target="_blank">RSS</a>
|
<a href="https://github.com/m-housh" rel="nofollow" target="_blank">Github</a>
|
<a href="https://www.youtube.com/channel/UCb58SeURd5bObfTiL0KoliA" rel="nofollow" target="_blank">Youtube</a>
|
<a href="https://www.facebook.com/michael.housh" rel="nofollow" target="_blank">Facebook</a>
|
<a href="mailto:michael@mhoush.com" rel="nofollow">Email</a>
</p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/keep-markup/prism-keep-markup.min.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js">
</script>
</div>
</body>
</html>