Add local folder to Nextcloud Snap as External Storage

After setting up my Ubuntu Server as a home server I wanted to make Nextcloud mount my network shared folder so I could alter files through the Nextcloud interface.

First I installed the Nextcloud removable media snap with,

sudo snap connect nextcloud:removable-media

which meant that the Nextcloud Snap would be able to access removable media (eg; anything mounted under /media). I then created a folder in media to mount to,

sudo mkdir /media/Public

and used bind to bring the two together.

sudo mount -o bind /home/<username>/Public/ /media/Public

I then tested the two were bound properly with,

ls /media/Public

To see if my files were there. Amazingly it all worked so logged into the admin account on Nextcloud, went to Settings in the right hand menu and then External Storages on the bottom left of the screen (If it isn’t there you may need to enable the module in Apps).

In Externals Storage add a folder name, choose Local for External Storage, Authentication (none), Put the file path in configuration (eg; /media/Public), choose what users you want it available for and click the tick.

If it goes green all should be well and you should be able to access the folder through the External Storage menu after logging in. To make the bind permanent you need to add it to your fstab so it lasts through reboot.

To do this make a backup of fstab,

sudo cp /etc/fstab /etc/fstab_backup

open up fstab in nano with,

sudo nano /etc/fstab

and add a line at the bottom. My one is,

home/<insert username>/Public /media/Public/ none bind

Yours can be whatever you want as long as you follow the same process. Be careful if you are not used to fstab, it is used to mount your disks when booting so if you don’t do it right then your computer won’t boot so make a backup first.

Before reboot you can test the config with,

sudo mount -a 

to see if it gives any errors.


This was now written a little while ago and there is also a Configuring External Storage (GUI) guide that is updated to the latest version in the Nextcloud official docs so that may well be helpful for you to read.

3 thoughts on “Add local folder to Nextcloud Snap as External Storage”

  1. Hi!

    Thank you for this guide, it was very useful!

    I created a new ~/Public folder, mounted it to /media/Public and enabled it as External Storage in Nextcloud. I can see its content and open the files from the UI. But it says “You don’t have permission to upload or create files here” on the page header, and indeed I cannot write anything in this folder. Changing the owner of /media/Public to root:root didn’t solve it.

    Did you not run into this problem? Do you have any clues how it could be solved?

    My setup is similar to yours: Ubuntu 18 LTS, Nextcloud Snap 16.0.7 installed with the default settings.

    • Hi! here is the way I solve the problem with โ€œYou donโ€™t have permission to upload or create files hereโ€ :
      go to /media
      change user and group of your Public folder to root
      Enjoy ๐Ÿ™‚

  2. Not entirely sure as I didn’t run into this problem but checking that the Public folder has the right permissions is the right idea.

    As is it Nextcloud accessing the folder I would start by giving the folder 777 permissions (change it back after you have sorted it. 777 is a large sec hole) and making sure it works then and work my way backwards. Nextcloud might be running as a different user for example and may have to be given permission. The best way would be to add them in fstab probably with something like default as the option.

    There are a lot of fstab options here


Leave a comment