# How to add samba shares and local shares to Nextcloud snap

**URL:** <https://help.nextcloud.com/t/how-to-add-samba-shares-and-local-shares-to-nextcloud-snap/216040>\
**Category:** 📑 How to\
**Tags:** snap, external\_storage, wiki, smb\
**Created:** [January 27, 2025, 9:38am UTC](https://help.nextcloud.com/t/how-to-add-samba-shares-and-local-shares-to-nextcloud-snap/216040 "2025-01-27T09:38:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![scubamuc](https://help.nextcloud.com/user_avatar/help.nextcloud.com/scubamuc/32/63165_2.png) [@scubamuc](https://help.nextcloud.com/u/scubamuc)\
**Post date:** [January 27, 2025, 9:38am UTC](https://help.nextcloud.com/t/how-to-add-samba-shares-and-local-shares-to-nextcloud-snap/216040/1 "2025-01-27T09:38:48Z")

</div>

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

[Snap confinement](https://snapcraft.io/docs/snap-confinement) is a **security feature** and determines the amount of access an application has to system resources, such as files, the network, peripherals and services. Thus your Nextcloud snap is securely confined from the host system. Unless you specifically allow the Nextcloud snap to access the `/media` or `/mnt` directories on the **host** system, you will not be able to access any other directory outside of the confinement.

Due to [Snap confinement](https://snapcraft.io/docs/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:

```bash
sudo snap connect nextcloud:removable-media

```

### External-storage app

Ensure that the [external-storage app](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage_configuration_gui.html) 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](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage_configuration_gui.html).

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](https://docs.nextcloud.com/server/25/admin_manual/configuration_files/external_storage_configuration_gui.html#enabling-external-storage-support).

![](https://user-images.githubusercontent.com/54933878/218519969-ff6ae69f-1f29-4f2a-b1c7-a5429cebdac1.png)

* * *

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [February 1, 2025, 8:48am UTC](https://help.nextcloud.com/t/how-to-add-samba-shares-and-local-shares-to-nextcloud-snap/216040/2 "2025-02-01T08:48:08Z")

</div>


