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
- Log into Nextcloud as admin
- Go to Apps (top-right menu)
- Search for “External storage support”
- Click Enable
Or via the command line:
docker exec -u www-data nextcloud php occ app:enable files_external
Supported Storage Types
| Backend | Protocol | Common Use |
|---|---|---|
| SMB/CIFS | Network shares (Windows/Samba) | NAS (Synology, TrueNAS, Unraid) |
| S3 Compatible | Amazon S3 API | AWS S3, MinIO, Backblaze B2, Wasabi |
| SFTP | SSH file transfer | Remote Linux servers |
| Local | Filesystem path | Directories on the same server |
| WebDAV | HTTP-based file access | Other Nextcloud/ownCloud instances |
| FTP | File Transfer Protocol | Legacy file servers |
| OpenStack Swift | Object storage | OpenStack 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
- Go to Administration Settings > External Storage
- 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
- Click the checkmark to save
SMB Configuration Table
| Field | Example Value | Notes |
|---|---|---|
| Host | 192.168.1.50 | NAS LAN IP address |
| Share | media | The share name, not the full path |
| Remote subfolder | movies | Optional — mount a subdirectory |
| Domain | (empty) | Only needed for Active Directory |
| Username | nextcloud_user | Create a dedicated NAS user |
| Password | strong_password | Store 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):
- Go to Administration Settings > External Storage
- Select Amazon S3 (works for any S3-compatible service)
- Configure:
| Field | AWS S3 Example | MinIO Example |
|---|---|---|
| Bucket | my-nextcloud-bucket | nextcloud |
| Hostname | (empty for AWS) | minio.local:9000 |
| Port | (empty for AWS) | 9000 |
| Region | us-east-1 | us-east-1 |
| Enable SSL | Yes | Depends on setup |
| Enable path style | No | Yes |
| Access key | AKIA... | MinIO access key |
| Secret key | wJal... | 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:
- Select Local as the storage type
- Enter the absolute path on the server (e.g.,
/mnt/data/shared) - 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-datauser (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:
- Select SFTP as the storage type
- 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 Type | Configured By | Available To | Use Case |
|---|---|---|---|
| Admin | Admin only | Selected users/groups | Shared NAS folders |
| Personal | Each user | Only that user | User’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:
| Concern | Impact | Mitigation |
|---|---|---|
| Preview generation | Slow on large media libraries | Disable previews for external storage |
| Search indexing | Full-text search may be slow | Exclude from search scope |
| Sync clients | Desktop sync follows external storage | Exclude from sync if large |
| File locking | May not work on all backends | Use 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
- Permissions: The web server user must have read/write access to external paths. In Docker, this is
www-data(UID 33). - Firewall: Ensure Nextcloud can reach the NAS/server on the required ports (SMB: 445, SFTP: 22, S3: 443/9000).
- SMB version: Some NAS devices default to SMBv1, which is insecure and slow. Force SMBv2+ in Nextcloud’s config.
- Large libraries: External storage with millions of files can slow the Nextcloud file listing. Use subfolder mounts to limit scope.
- Docker networking: If your NAS is on the host network, use the host IP (not
localhost) from inside the container. Or usenetwork_mode: host.
Next Steps
- Set up Nextcloud file versioning to protect against accidental changes
- Configure Backup Strategy for your external storage independently of Nextcloud
- Explore Nextcloud: Slow Performance — Fix if external storage impacts performance
Related
Get self-hosting tips in your inbox
Get the Docker Compose configs, hardware picks, and setup shortcuts we don't put in articles. Weekly. No spam.
Comments