<p>
A network attached storage (NAS) provides file-based data storage<br />
to other devices on the network. The files can be shared between the devices.
</p>
<p>
This article is complementary to <a href="/index.php?nav=OpenWrt">OpenWrt</a>.
</p>

<h3>Contents</h3>
<ul>
<li><a href="#mount">Mount Points</a>
<ul>
<li><a href="#mount_pkgs">Packages</a></li>
<li><a href="#mount_config">Configuration</a></li>
</ul>
</li>
<li><a href="#shares">Network Shares</a>
<ul>
<li><a href="#shares_pkgs">Packages</a></li>
<li><a href="#shares_config">Configuration</a></li>
</ul>
</li>
<li><a href="#sftp">SFTP</a>
<ul>
<li><a href="#sftp_pkgs">Packages</a></li>
</ul>
</li>
<li><a href="#dlna">DLNA</a>
<ul>
<li><a href="#dlna_pkgs">Packages</a></li>
</ul>
</li>
<li><a href="#links">External Links</a></li>
</ul>

<h3 id="mount">Mount Points</h3>
<p>
To use an external storage device, the device needs to be mounted.
</p>

<h4 id="mount_pkgs">Packages</h4>
<ul>
<li><a href="https://openwrt.org/packages/pkgdata/kmod-usb-storage" target="_blank">kmod-usb-storage</a><br />
Kernel module for USB storage support.</li>
<li><a href="https://openwrt.org/packages/pkgdata/block-mount" target="_blank">block-mount</a><br />
If this package is installed, the web interface shows <em>Mount Points</em> under <em>System</em>.</li>
<li><a href="https://openwrt.org/packages/pkgdata/kmod-fs-ext4" target="_blank">kmod-fs-ext4</a><br />
Kernel module for EXT4 (native Linux file system) support.</li>
<li><a href="https://openwrt.org/packages/pkgdata/ntfs-3g" target="_blank">ntfs-3g</a><br />
In case NTFS (native Windows file system) support is needed,<br />
this user-space driver provides read and write access.<br />
In general, the performance of user-space drivers is not as good as<br />
drivers implemented as kernel modules.</li>
</ul>

<h4 id="mount_config">Configuration</h4>
<p>
In the web interface, the option <em>Mount Points</em> edits the following file:
</p>
<dl class="file">
<dt><code class="filename">/etc/config/fstab</code></dt>
<dd>
<pre class="file"><code class="language-plaintext">config global
    option anon_swap '0'
    option anon_mount '0'
    option auto_swap '1'
    option auto_mount '1'
    option delay_root '5'
    option check_fs '0'

config mount
    option enabled '1'
    option label 'SSD'
    option target '/mnt/ssd'
</code></pre>
</dd>
</dl>

<h3 id="shares">Network Shares</h3>

<h4 id="shares_pkgs">Packages</h4>
<ul>
<li><a href="https://openwrt.org/packages/pkgdata/samba4-server" target="_blank">samba4-server</a><br />
The actual server software that shares the files.</li>
<li><a href="https://openwrt.org/packages/pkgdata/luci-app-samba4" target="_blank">luci-app-samba4</a><br />
This package shows <em>Network Shares</em> under <em>Services</em> in the web interface.</li>
</ul>

<h4 id="shares_config">Configuration</h4>
<p>
The option <em>Network Shares</em> edits the following file:
</p>
<dl class="file">
<dt> <code class="filename">/etc/config/samba4</code></dt>
<dd>
<pre class="file"><code class="language-plaintext">config samba
    option workgroup 'WORKGROUP'
    option charset 'UTF-8'
    option description 'Samba on OpenWRT'
    option interface 'lan'
    option macos '1'
    option allow_legacy_protocols '1'

config sambashare
    option name 'ssd'
    option path '/mnt/ssd'
    option read_only 'no'
    option guest_ok 'yes'
    option create_mask '0666'
    option dir_mask '0777'
</code></pre>
</dd>
</dl>
<p>
Do not forget to restrict the access to the share to the LAN interface.
</p>

<h3 id="sftp">SFTP</h3>
<p>Secure File Transfer Protocol</p>

<h4 id="sftp_pkgs">Packages</h4>
<ul>
<li><a href="https://openwrt.org/packages/pkgdata/openssh-sftp-server" target="_blank">openssh-sftp-server</a><br />
SFTP server software.
</li>
</ul>

<h3 id="dlna">DLNA</h3>
<p>Digital Living Network Alliance</p>

<h4 id="dlna_pkgs">Packages</h4>
<ul>
<li><a href="https://openwrt.org/packages/pkgdata/minidlna" target="_blank">minidlna</a><br />
DLNA compliant server software.</li>
<li><a href="https://openwrt.org/packages/pkgdata/luci-app-minidlna" target="_blank">luci-app-minidlna</a><br />
This package shows <em>miniDLNA</em> under <em>Services</em> in the web interface.</li>
</ul>

<h3 id="links">External Links</h3>
<ul>
<li><a href="https://openwrt.org/docs/guide-user/services/nas/usb-storage-samba-webinterface" target="_blank">
https://openwrt.org/docs/guide-user/services/nas/usb-storage-samba-webinterface</a></li>
</ul>