Nextcloud External Storage Setup Guide

What Is External Storage?

Nextcloud’s External Storage feature lets you mount remote storage — NAS shares, S3 buckets, FTP servers, or local directories — as folders inside your Nextcloud. Users see them alongside their regular files, with the same sharing, search, and preview capabilities. This means you can keep files on your NAS or cloud storage while managing them through Nextcloud’s interface.

Prerequisites

  • A working Nextcloud instance (setup guide)
  • The External Storage Support app enabled (built into Nextcloud, needs activation)
  • Network access from your Nextcloud server to the external storage

Enable the External Storage App

  1. Log into Nextcloud as admin
  2. Go to Apps (top-right menu)
  3. Search for “External storage support”
  4. Click Enable

Or via the command line:

docker exec -u www-data nextcloud php occ app:enable files_external

Supported Storage Types

BackendProtocolCommon Use
SMB/CIFSNetwork shares (Windows/Samba)NAS (Synology, TrueNAS, Unraid)
S3 CompatibleAmazon S3 APIAWS S3, MinIO, Backblaze B2, Wasabi
SFTPSSH file transferRemote Linux servers
LocalFilesystem pathDirectories on the same server
WebDAVHTTP-based file accessOther Nextcloud/ownCloud instances
FTPFile Transfer ProtocolLegacy file servers
OpenStack SwiftObject storageOpenStack deployments

Mount a SMB/CIFS Share (NAS)

The most common use case — mounting a Synology, TrueNAS, or Samba share.

Docker: Install SMB Client

The official Nextcloud Docker image doesn’t include the SMB client by default. Install it:

docker exec nextcloud apt-get update && docker exec nextcloud apt-get install -y smbclient libsmbclient-dev
docker exec nextcloud pecl install smbclient
docker exec nextcloud docker-php-ext-enable smbclient
docker restart nextcloud

For a persistent fix, create a custom Dockerfile:

FROM nextcloud:33.0.0
RUN apt-get update && apt-get install -y smbclient libsmbclient-dev \
    && pecl install smbclient \
    && docker-php-ext-enable smbclient \
    && rm -rf /var/lib/apt/lists/*

Configure the Mount

  1. Go to Administration Settings > External Storage
  2. Fill in:
    • Folder name: Display name in Nextcloud (e.g., “NAS Media”)
    • External storage: SMB/CIFS
    • Authentication: Username and password
    • Host: NAS IP address (e.g., 192.168.1.50)
    • Share: Share name on the NAS (e.g., media)
    • Remote subfolder: Optional path within the share
    • Domain: Windows domain (leave empty for most NAS setups)
    • Username: NAS account username
    • Password: NAS account password
  3. Click the checkmark to save

SMB Configuration Table

FieldExample ValueNotes
Host192.168.1.50NAS LAN IP address
SharemediaThe share name, not the full path
Remote subfoldermoviesOptional — mount a subdirectory
Domain(empty)Only needed for Active Directory
Usernamenextcloud_userCreate a dedicated NAS user
Passwordstrong_passwordStore in Nextcloud’s credential store

Security tip: Create a dedicated user on your NAS with access only to the shares Nextcloud needs. Don’t use your admin account.

Mount an S3 Bucket

For cloud storage integration (AWS S3, MinIO, Backblaze B2):

  1. Go to Administration Settings > External Storage
  2. Select Amazon S3 (works for any S3-compatible service)
  3. Configure:
FieldAWS S3 ExampleMinIO Example
Bucketmy-nextcloud-bucketnextcloud
Hostname(empty for AWS)minio.local:9000
Port(empty for AWS)9000
Regionus-east-1us-east-1
Enable SSLYesDepends on setup
Enable path styleNoYes
Access keyAKIA...MinIO access key
Secret keywJal...MinIO secret key

Self-Hosted MinIO Example

If you run MinIO alongside Nextcloud:

# Add to your Docker Compose
services:
  minio:
    image: minio/minio:RELEASE.2026-03-01T00-00-00Z
    container_name: minio
    command: server /data --console-address ":9001"
    environment:
      - MINIO_ROOT_USER=minioadmin
      - MINIO_ROOT_PASSWORD=minioadmin_password
    volumes:
      - minio_data:/data
    ports:
      - "9000:9000"
      - "9001:9001"
    restart: unless-stopped

Mount a Local Directory

To expose a server directory through Nextcloud:

  1. Select Local as the storage type
  2. Enter the absolute path on the server (e.g., /mnt/data/shared)
  3. Set permissions

For Docker, mount the host directory into the container:

services:
  nextcloud:
    image: nextcloud:33.0.0
    volumes:
      - nextcloud_data:/var/www/html
      - /mnt/nas/media:/mnt/external/media  # Mount host directory

Then in External Storage settings, use /mnt/external/media as the local path.

Permission note: The www-data user (UID 33) inside the container must have read access to the mounted directory. Set permissions on the host:

sudo chown -R 33:33 /mnt/nas/media
# Or if you can't change ownership:
sudo chmod -R o+r /mnt/nas/media

Mount SFTP Storage

For mounting files from a remote Linux server:

  1. Select SFTP as the storage type
  2. Configure:
    • Host: Remote server hostname or IP
    • Root: Remote directory path (e.g., /home/user/files)
    • Username: SSH username
    • Password or Public key: SSH authentication

Using SSH Keys

For key-based authentication, generate a key pair:

docker exec -u www-data nextcloud ssh-keygen -t ed25519 -f /var/www/html/data/.ssh/id_ed25519 -N ""

Copy the public key to the remote server:

docker exec -u www-data nextcloud cat /var/www/html/data/.ssh/id_ed25519.pub
# Add this to the remote server's ~/.ssh/authorized_keys

Then select RSA public key authentication in Nextcloud and provide the key paths.

User-Specific vs Admin Mounts

Mount TypeConfigured ByAvailable ToUse Case
AdminAdmin onlySelected users/groupsShared NAS folders
PersonalEach userOnly that userUser’s own NAS folder

To allow personal mounts, enable “Allow users to mount external storage” in Administration Settings > External Storage.

Performance Considerations

External storage has different performance characteristics than local Nextcloud storage:

ConcernImpactMitigation
Preview generationSlow on large media librariesDisable previews for external storage
Search indexingFull-text search may be slowExclude from search scope
Sync clientsDesktop sync follows external storageExclude from sync if large
File lockingMay not work on all backendsUse advisory locking only

To disable previews for an external mount:

docker exec -u www-data nextcloud php occ config:app:set previewgenerator paths --value="/path"

Common Mistakes

  1. Permissions: The web server user must have read/write access to external paths. In Docker, this is www-data (UID 33).
  2. Firewall: Ensure Nextcloud can reach the NAS/server on the required ports (SMB: 445, SFTP: 22, S3: 443/9000).
  3. SMB version: Some NAS devices default to SMBv1, which is insecure and slow. Force SMBv2+ in Nextcloud’s config.
  4. Large libraries: External storage with millions of files can slow the Nextcloud file listing. Use subfolder mounts to limit scope.
  5. Docker networking: If your NAS is on the host network, use the host IP (not localhost) from inside the container. Or use network_mode: host.

Next Steps

Comments