Nextcloud External Storage Setup Guide
Complete guide to Nextcloud external storage setup. Configure S3, SMB, SFTP, NFS, and local drives. Includes troubleshooting, permissions, and security best practices.
- Nextcloud external storage mounts S3, SMB, SFTP, NFS, or local drives into your file tree without forcing data migration.
- Seven backends are supported: Local (fastest), SMB (for NAS), SFTP (for remote servers), S3 (unlimited scale), NFS (data center), and FTP/WebDAV (rarely used).
- Setup requires the External Storage Support app enabled, valid credentials tested outside Nextcloud, and correct file permissions on the backend.
- Permission errors and connection timeouts are the most common issues; they are fixable by verifying credentials and network connectivity.
- External storage is slower than local disk (50-200 ms latency typical), so use it for archives or less-frequently accessed data.
Nextcloud external storage lets you mount remote drives, cloud buckets, or network shares directly into your Nextcloud file tree. Instead of uploading terabytes into Nextcloud's native storage, you point at S3, SMB, SFTP, or NFS and users access those files through Nextcloud. This guide covers seven backends, step-by-step setup, permissions, troubleshooting, and performance optimization.
What Is External Storage in Nextcloud?
External storage is a Nextcloud feature that mounts remote storage backends into your Nextcloud directory structure. When you mount an NFS share or S3 bucket as external storage, it appears as a folder in the Nextcloud file browser. Users get unified permissions, sharing, versioning, and mobile access across all storage types, local or remote.
Nextcloud handles the plumbing: it connects to the backend, authenticates, handles disconnections, and caches metadata. From the user's perspective, it looks and behaves like native Nextcloud storage. But the actual files live elsewhere: on a NAS, in AWS, on a remote server, or on a second disk.
The External Storage Support app enables this. It's bundled with Nextcloud but disabled by default. You enable it in Admin > Apps, then navigate to Admin > External Storages to add backends. Nextcloud 28+ has a user-friendly form; older versions require more manual input.
Why Use External Storage: Three Common Scenarios
Scenario 1: Integrate Existing NAS Storage. Your team already has a Synology or QNAP NAS with 4 TB of project files. Migrating everything to Nextcloud would take weeks and cost money. Instead, mount the NAS as external storage via SMB, assign it to a group, and your team accesses the same files through Nextcloud's interface, mobile apps, and sharing controls. No migration, no downtime.
Scenario 2: Add Cheap, Unlimited Archive Storage. Your Nextcloud server has 500 GB of SSD. You store a mix of active documents (100 GB, frequently accessed) and archived invoices (2 TB, rarely touched). Keep hot data on fast local disk. Mount a 5 TB S3 bucket as external storage for archives. Cost: roughly 1 USD per month for storage. Fast data stays fast. Old data stays cheap.
Scenario 3: Sync Between On-Premise and Cloud Nextcloud. Your company runs Nextcloud in the data center and wants a read-only disaster-recovery copy in the cloud. Mount the cloud Nextcloud storage via SFTP as external storage in the on-premise instance. Or do the reverse: give remote employees access to on-premise files via SFTP external storage in a cloud Nextcloud. Both instances point at the same files; users see unified data.
External Storage Backends: Comparison and When to Use Each
Nextcloud supports seven backends. Here's how they compare:
| Backend | Protocol | Speed | Setup | Best For | Notes |
|---|---|---|---|---|---|
| Local | Filesystem | Very Fast | File permissions | Second disk, mounted shares | No network latency |
| SMB/CIFS | Windows/Unix sharing | Fast (LAN) | UNC path + credentials | Windows shares, NAS | 50-100 ms latency on LAN |
| SFTP | SSH file transfer | Medium | Hostname + key or password | Remote Unix servers, WAN | 200-500 ms over internet |
| S3 | Object storage API | Medium | Bucket + API keys | Cloud archives, unlimited scale | $0.023/GB/month + requests |
| NFS | Unix file sharing | Very Fast (LAN) | Server address + mount options | Data center, Unix-to-Unix | Requires NFS server setup |
| FTP | File transfer protocol | Slow | FTP credentials | Rare; use SFTP instead | Unencrypted, obsolete |
| WebDAV | HTTP-based sharing | Medium | WebDAV URL + credentials | Some cloud services | Limited support |
Local storage is a filesystem mount on the Nextcloud server itself: /mnt/backup, /mnt/archive, or a second physical disk. No credentials, no network round-trips, lowest latency. Use it when you've added a second disk to the server or mounted a network share locally on the Nextcloud host.
SMB/CIFS is for Windows file shares and network-attached storage (Synology, QNAP, Nextcloud Box, Windows Server). You provide the UNC path (\\nas.local\share), username, and password. SMB works over LAN at gigabit speeds with 50-100 ms latency. It's older than NFS and more chatty, making it slightly slower, but it's industry standard for NAS devices.
SFTP is for remote Unix servers. You SSH into the server, authenticate with a username/password or SSH key, and Nextcloud reads/writes files via the SFTP protocol. Latency is higher than SMB on LAN (200-500 ms over the internet), but SFTP works through firewalls and doesn't require local network access. Essential for cloud backups, hybrid setups, or multi-site Nextcloud instances.
Amazon S3 (or MinIO, DigitalOcean Spaces, Backblaze B2) stores files as objects in a bucket. You authenticate with an Access Key and Secret Key (or IAM role). S3 is network-agnostic, geo-replicated, and scales to unlimited size. Latency is typically 50-200 ms. Costs are roughly $0.023 per GB per month for storage, plus $0.004 per 10,000 GET requests. Best for long-term archives, disaster recovery, and teams spanning regions.
NFS is the Unix native: fast, reliable, and designed for data centers. Requires NFS server setup and works best on local networks. Not suitable for untrusted networks or remote access because NFS lacks encryption. Use it in your data center between Unix machines.
FTP and WebDAV are rarely needed. FTP is unencrypted and slow; SFTP is better. WebDAV is niche; use it only if your external storage provider exposes WebDAV explicitly.
Before You Start: Prerequisites and Planning
Gather these before you set up external storage.
First: Credentials. Write down the exact credentials you'll use: SMB username and password, SFTP hostname and SSH key, S3 bucket name and API keys, NAS IP address. Do not invent or guess. Test them outside Nextcloud first.
Second: Network Connectivity. From the Nextcloud server, verify you can reach the storage backend. SSH into the Nextcloud host and test:
- SMB:
smbclient -L \\192.168.1.50 -U username - SFTP:
sftp username@remote.example.com - S3:
aws s3 ls s3://my-bucket --region us-east-1(requires AWS CLI) - NFS:
showmount -e 192.168.1.50(requires nfs-utils) - Local:
ls -la /mnt/backup
If the test fails, Nextcloud will fail too.
Third: Permissions. Nextcloud runs as a system user (usually www-data on Linux or nextcloud on Docker). For local mounts, this user must have read/write permission. For SMB, the credentials must be valid. For SFTP, the SSH key must be valid. For S3, the API key must have bucket access. Check these before you touch the GUI.
Fourth: Deployment Context. Are you running Nextcloud natively, in Docker, as Snap, or with Nextcloud AIO? Each has different mount paths and permissions requirements. We'll cover specifics later.
Enable External Storage Support
Log in to Nextcloud as an admin. Go to top right > Settings > Administration > External Storages. You'll see a blank table. If the table is missing, external storage support is not enabled.
To enable it: Settings > Administration > Apps. Search "external storage". Click Enable on the External Storage Support app. Now return to Administration > External Storages. The table should appear.
Step-by-Step Setup: Configure Each Backend
Local Storage
- SSH into the Nextcloud server.
- Verify the mount exists and is readable:
ls -la /mnt/backup. - Check permissions:
stat /mnt/backup. Look for the Access field. The Nextcloud user (usuallywww-data) must have read and write. - If not, fix permissions:
sudo chown www-data:www-data /mnt/backup && sudo chmod 755 /mnt/backup. - In Nextcloud Admin > External Storages, click + Add storage. Choose "Local".
- Enter the mount point:
/mnt/backup. - Click the checkmark. If it turns green, the mount is connected. If red, re-check step 4.
SMB/CIFS (NAS, Windows Shares)
- In Nextcloud Admin > External Storages, click + Add storage. Choose "SMB/CIFS".
- Enter the server address:
\\nas.localor192.168.1.50. (No UNC slashes in Nextcloud; just the hostname.) - Enter the share name:
media. (Do not include leading backslashes.) - Enter the username and password for the share.
- Click the checkmark. If green, you're mounted. If red, verify the share is accessible:
- From the Nextcloud server, run:
smbclient -L \\nas.local -U username. You should see the share listed. - Check the password is correct.
- Verify the server IP or hostname is reachable:
ping nas.local.
- From the Nextcloud server, run:
SFTP (Remote Servers)
- In Nextcloud Admin > External Storages, choose "SFTP".
- Enter the hostname:
backup.example.comor203.0.113.45. - Enter the port (default 22).
- Enter the username and password, or paste a private SSH key (PEM format).
- Enter the root path:
/home/user/storage. This is the directory Nextcloud will start from when connecting via SFTP. - Click the checkmark. If red, test manually from the Nextcloud server:
ssh user@backup.example.com(verify login works).sftp user@backup.example.comthencd /home/user/storageandls(verify the path exists and is readable).
Amazon S3 or MinIO
- In Nextcloud Admin > External Storages, choose "Amazon S3".
- Enter the bucket name:
my-archive. - Enter the Access Key and Secret Key from your AWS or MinIO account.
- (Optional) Select the region if not US East 1. For MinIO, change the hostname to your MinIO server and enable SSL if applicable.
- Click the checkmark. If red, verify credentials:
- Log into the AWS Console or MinIO web UI.
- Confirm the key pair exists and has permissions for the bucket.
- Re-enter the keys if you see any typos.
Permissions, Access Control, and Testing
Once a backend turns green, you control who sees it. Expand the row and under "Available for" select the groups or users who should access this mount. Leave it blank if only admins should see it (good for testing). Assign it to a group once you've verified files are readable.
Now ask a regular user to log into Nextcloud. They should see the mounted folder in their file list (e.g., "Archive" or "Shared NAS"). Have them upload a small test file. Check that the file appears on the actual backend: look in the NAS folder, refresh the S3 console, check the SFTP server. If the file is there, write access works.
If a user cannot see the folder, check: (1) Are they in the assigned group? (2) Do they have at least "View" permission? (3) Does the folder exist on the backend?
Performance Optimization Techniques
External storage is never as fast as local disk because access involves network latency and sometimes authentication overhead. Here's how to minimize the impact.
Enable File Locking and Background Indexing: Admin > Settings > Caching. Enable "Use File Locking" and "Background Indexing". This reduces repeated requests to the backend for file metadata.
Use Caching for Metadata: Nextcloud caches file listings in the database. The first access to an external folder is slow (it reads the backend). Subsequent accesses are fast. For large external shares, the initial scan can take minutes. Plan for this.
Optimize Network: Ensure the Nextcloud server and storage backend have a stable, low-latency connection. For SMB on LAN, this is automatic. For SFTP over the internet, consider a VPN to reduce latency. For S3, use the correct AWS region to minimize distance.
Monitor Performance: Admin > System > Logs. Look for timeout errors. If you see "Connection Timeout" or "Operation Timed Out", the network is too slow. Consider moving the storage closer (geographically or on the same LAN).
Disable Unused Mounts: Each external mount adds overhead to file operations. If a mount is rarely used, disable it (uncheck the checkbox) or delete it.
Security Best Practices
Credentials: Nextcloud stores credentials in the database, encrypted. But rotate them every 90 days. For SMB, change the password on the NAS. For S3, rotate your API keys in the AWS console. For SFTP, regenerate the SSH key.
SSH Keys Over Passwords: For SFTP, always use an SSH key instead of a password. SSH keys are harder to steal and can be restricted to specific actions. Paste the private key (PEM format) into Nextcloud. Store the private key file on disk with restrictive permissions: chmod 600 ~/.ssh/id_rsa.
Least Privilege: For S3, don't use your main AWS account. Create an IAM user with permissions only for the specific bucket and only for the actions Nextcloud needs (GetObject, PutObject, ListBucket). For SMB, create a dedicated user on the NAS with read-only access if the mount is archive-only.
Audit Logging: Admin > Logging. Enable audit logging. Nextcloud will log who accessed which external files and when. Review logs monthly for unusual activity.
Encryption in Transit: For SMB, ensure the NAS supports SMB 3.0 or higher (encrypted by default). For SFTP, SSH is always encrypted. For S3, Nextcloud uses HTTPS. For FTP (if used), do not use it; it sends credentials in cleartext.
Troubleshooting Common Errors
Red Icon with No Error Message: Click the info icon next to the mount. Nextcloud will show a specific error or just say "not accessible". Most common cause: incorrect credentials or network unreachable.
"Permission Denied": The storage backend accepted the connection but rejected the operation. For local mounts, the Nextcloud user lacks read/write permission. Fix: sudo chown www-data:www-data /mnt/backup && sudo chmod 755 /mnt/backup. For SMB, the username/password is incorrect or has no write permission. For SFTP, the SSH key or password is wrong, or the user lacks permission on the remote path. For S3, the API key lacks PutObject permission.
"Connection Timeout" or "Host Unreachable": Network issue. From the Nextcloud server, ping the storage backend. Check firewall rules. SMB needs port 445 open. SFTP needs port 22 (or custom). S3 needs HTTPS outbound (port 443). NFS needs port 2049.
"Authentication Failed" (SMB): Typo in username or password, or the credential string is malformed. Re-enter credentials. If the NAS uses a domain (Active Directory), include the domain: DOMAIN\username.
"Cannot Connect to Server" (SFTP): The hostname is wrong or the server is offline. From the Nextcloud server, test: ssh -i /path/to/key user@hostname. If that fails, the server is unreachable or SSH is not listening.
Mount Appears Empty (Nothing to List): The backend is connected but the root path is wrong. For SFTP, the root path must be a valid directory on the remote server. For S3, the bucket must exist and be non-empty. For SMB, the share must contain files. Check the backend directly and re-enter the path.
Deployment-Specific Considerations
Docker: If Nextcloud runs in a Docker container, mounts on the host are not visible inside the container. You must mount the external storage inside the Docker container's mount points. Add a volume to your docker-compose.yml: volumes: - /host/path:/container/path. Then use /container/path as the local mount in Nextcloud. For Nextcloud AIO, the official documentation covers external storage setup; follow the AIO guide for the correct mount locations.
Snap: Nextcloud Snap runs in a confined environment. Local mounts must be in /home or /media to be accessible. Use sudo snap connect nextcloud:removable-media to grant permission. For remote storage (SMB, SFTP, S3), Snap works normally.
Native Linux: No special considerations. Mounts work as described above.
Frequently Asked Questions
Can I make external storage my primary data directory? No. The External Storage app mounts storage into the Nextcloud file tree. The primary data directory must stay local. Changing the data directory itself is a separate (risky) task requiring database migration. Not recommended.
Why is my external storage showing a red error icon? Nextcloud cannot connect or authenticate. Check network connectivity, credentials, and that the backend is online. Hover over the red icon for the specific error. Most common: incorrect password, wrong hostname, or firewall blocking the connection.
Does external storage slow down Nextcloud? Yes, slightly. Accessing external storage adds network latency (even on LAN, SMB adds 50-100 ms per operation). Local files are faster. If performance is critical, keep hot data local and use external storage for archives or infrequently accessed data.
Will files on external storage be encrypted? Only if Nextcloud's encryption is enabled (Security > Enable Encryption). The files themselves are encrypted on disk (encrypted container) but the backend storage backend still stores encrypted data. Transport is encrypted if you use SFTP (SSH), S3 (HTTPS), or SMB 3.0+.
Can I use the same external storage for multiple Nextcloud instances? Yes, but expect locking and consistency issues. Two Nextcloud instances writing to the same SMB share or S3 bucket can corrupt files. Use a shared locking mechanism or designate one Nextcloud instance as the primary writer.
What happens if the external storage goes offline? Users cannot access files on that mount. The folder appears but reads/writes fail. Once the backend comes back online, access resumes. Nextcloud does not delete local caches, so metadata remains.
Can I encrypt the transport between Nextcloud and external storage? Yes. SFTP and S3 use encryption by default. SMB should use version 3.0+. NFS does not encrypt (use a VPN if you need encryption over WAN). FTP sends credentials in cleartext; never use it.
The Bottom Line
External storage connects Nextcloud to your existing infrastructure without forcing migration. Local mounts are fast and simple. SMB mounts NAS and Windows shares. SFTP mounts remote servers. S3 mounts unlimited cloud storage. Start with one backend, verify it works, then scale. Expect permission errors on first try, but they're straightforward to fix. Once mounted, users access files through Nextcloud's interface with no knowledge of where they actually live.
If you want external storage managed for you, Opsily's hosted Nextcloud handles setup, optimization, and security. Get started free at console.opsily.com.