How to add samba shares and local shares to Nextcloud snap

How to add samba shares and local shares to Nextcloud snap as external-storage


Due to Snap confinement, adding samba-shares, network-shares and local-shares such as NAS storage, USB storage and other external storage devices requires careful configuration.

Procedure for mounting share on host

The same procedure may be used for samba, NFS, USB-devices and other local shares.

  • connect removable media to snap
  • install external storage in Nextcloud snap
  • configure share on host
  • mount share directory to /mnt or /media in fstab on host
    • mount as root with root permissions
  • configure external storage app

Removable media and permissions

Removable media must be mounted to either /media or /mnt as root with root permissions and connected to Snap!

Removable media can be any device (e.g. external-disk-partition, SAMBA-network mount, NFS-network mount, SSHFS-network mount etc.). The device should be available at system boot and mounted in /etc/fstab on host.

The interface providing the ability to access removable media is not automatically connected upon Nextcloud snap installation, so if you’d like to use external storage (or otherwise use a device in /media or /mnt for data), you need to give snap permission to access removable media by connecting that interface.

Issue command in host shell:

sudo snap connect nextcloud:removable-media

External-storage app

Ensure that the external-storage app is installed in your Nextcloud instance. Refer to your Nextcloud manual for installing apps in your Nextcloud instance.

Configure samba on host

Samba should be correctly installed and configured on the host running Nextcloud snap. Both SMB and CIFS file sharing protocol should be installed on the host. Refer to your distribution documentation for information. Refer to your distribution documentation for mounting devices or shares in fstab.


Mount directory and permissions

Removable media must be mounted to either /media or /mnt as root with root permissions and connected to Snap!

Tipp: Ensure USB-boot is disabled in BIOS or use the --nofail option in /etc/fstab for headless boot, especially when connecting an external USB-device.

Tipp: Its not recommended to use the β€œautomount” directory /media/$USER/. Prefer creating a dedicated directory /media/nextcloud/ or /mnt/nextcloud/ and mounting the dedicated directory in /etc/fstab.

Other shares:

smb/cifs – please ensure that smb/cifs FUSE-Module is correctly installed on the host and refer to the distribution documentation for mounting in /etc/fstab.
sshfs – please ensure that sshfs FUSE-Module is correctly installed on the host and refer to the distribution documentation for mounting in /etc/fstab.
davfs – please ensure that davfs and/or davfs2 is correctly installed on the host and refer to the distribution documentation for mounting in /etc/fstab.
sftp/ftps – please ensure that FTP/s and/or SSH is correctly installed on the host and refer to the distribution documentation for mounting in /etc/fstab.

Configure external-storage app

In order to make the above devices or shares available for Nextcloud users or groups the external-device or network-share must be added in Settings β†’ External Storage. Please also refer to your Nextcloud manual.

  1. Enter a name in the field Folder-name or path to folder in nextcloud e.g. /Documents/Foldername
  2. For storage type select Local
  3. For authentication select none or enter user or network authentication. Note: authentication is not necessary for fstab mounts as root (please refer to fstab documentation)
  4. For configuration enter the path to mount point e.g. /media/DEVICENAME or /media/LINKNAME
  5. User and group permissions as well as read/write permissions may be configured in the options menu in external-storage app
  6. Mount options may be configured in the options menu in external-storage app

Connect home directory

In a self-hosted environment on Ubuntu where SSH is available on the local network, yet blocked externally (firewall/router), you can access any local non-root directory, such as your home directory by connecting to local server via SFTP using the external storage app.


1 Like