Nextcloud is a suite of client-server software for creating and using file hosting services, which is most powerfully paired with FreeNAS when you are able to configure it to access your stored data on your server (e.g. beyond just a jail running Nextcloud). These mount points you are likely to share via samba (Windows file sharing)over your local and are likely to backup through whatever means works best for you. As mentioned in the previous article, FreeNAS: Nextcloud Install with SSL Access, the Nextcloud application provides functionally which is similar to Dropbox, however unlike Dropbox, Nextcloud does not offer off-premises file storage hosting. As I have previously noted, it is critical that you have an off-premise copy of all sensitive data (which is encrypted). Unlike Dropbox however, Nextcloud is free and open-source, which means that anyone is allowed to install and operate it on their own private server devices. In contrast to proprietary services like Dropbox, the open architecture allows adding functionality to the server in the form of applications and enables users to have full control of their data and keeps data secure and free from the prying eyes of big companies like Google and Dropbox.
This article is part of my series of FreeNas setup, configuration and install articles.
An updated version of this article is posted on the NEW digiMoot website at:
Creating Mount Points
The first thing you will need to do is create mount points within your NextCloud jail which point to the data directories that you want to access via Nextcloud. You first need to create directories to contain the mounted folders; I usually create these in the
/mnt/ location. Once these directories are created, you will need to stop the Nextcloud jail from the jail tab in your FreeNAS webui. Once stopped, click the three dots and select ‘Mount Points’. Click ‘Action’ at the top right and then ‘+ Add Mount Point’. Follow the instructions in the dialog to add your mount point. Rinse and repeat for all your mount points.
Enabling External Storage in FreeNAS
Next we will need to turn on the add-on within Nextcloud which allows us to access external folders (in this case external means within the jail, but external to the configured Nextcloud base folder). You will need to start your Nextcloud jail again, and then from your Nextcloud WebUI, click on your user icon, in the top right and then select ‘Apps’. In the screen below, the user icon is the ‘A’ in the circle.
Scroll down the list and click the enable button next to external storage (possibly called ‘External Storage Support’ in newer versions and it is usually disabled for new installs, and it should be near the bottom of the app list).
Adding External Storage Locations
Now that External Storage is enabled we can add some of you external sources. Click on your user icon again, in the top right again and select ‘Settings’. In the menu on the left of the screen, under the ‘Administration’ section, you should see an ‘External Storages’ option on the left hand side of the page. Click it. You will be presented with a screen which is asking you for a folder name and the has a drop down for add storage. The folder name is the folder name which will appear in Nextcloud and for storage we will select local. Once you’ve done that additional options will pop up: set authentication to none, in configuration you will put the mount location of the data (we setup the
/mnt/ location earlier) and optionally you can select the users for which the data is available. Once done it should look something like what is the image below.
Nextcloud External Storage Permission
Ensuring the correct permissions is essential. Nextcloud access resources using the ‘web’ user and the ‘web’ group. As such, we will need to ensure that all of your mount points are owned by www:www have full access to directories and files. In other articles I have recommended that the owner of all your storage files (or at least those that would be accessible through Nextcloud) be owned by www:www and with 744 permissions set. If you need to change this now you can do so through the FreeNAS WebUI by changing permisssions in your data sets. BE CAREFUL doing this as if you haven’t setup your datasets correctly and system or jail information is stored with your dataset, then changing permissions can really bugger things up. To change permissions on a dataset go to ‘Storage -> Pools’ and then expand your pool and select the three dots beside the dataset your looking for and click ‘edit permissions’. You could of course also do this using the
chown commands from the command line; be certain you apply recursively.
Once you’re sure the permissions are set correctly, you can head to the FreeNAS WebUI and you should be able to see and access all of your mount points! If you’ve changes privileges and it still says can’t access, it might help to delete the storage from NextCloud and re-add it back on.