setup

Set Up an SMB Share as Nextcloud External Storage

Mount an existing SMB share in Nextcloud, choose who can access it, and verify the connection from the Files app and with OCC commands.

Illustrated title card for the guide: Set Up an SMB Share as Nextcloud External Storage

To add an existing SMB share to Nextcloud, enable External Storage Support and add an SMB/CIFS mount in the admin settings. Enter the SMB host, share and credentials, then use Available for to choose the users or groups who should see the folder in Files. Admin mount settings · SMB/CIFS fields · External storage in Files

Check SMB support and reachability

Sign in as a Nextcloud administrator and enable External Storage Support under Apps. Enable External Storage Support

The Nextcloud server needs the PHP smbclient module or the smbclient binary. Nextcloud recommends the PHP module and falls back to the binary when the module is absent. SMB/CIFS requirements

On a manual Debian or Ubuntu installation, run OCC from the Nextcloud directory as www-data, using the same PHP version as the web server. OCC runtime

files_external:dependencies reports missing PHP extensions or system packages for configured external storage backends. OCC dependency check

sudo -E -u www-data php occ files_external:dependencies

On Nextcloud All-in-One (AIO), run the check inside the Nextcloud container. AIO OCC wrapper · OCC dependency check

sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ files_external:dependencies

If the Samba CLI is available on the Nextcloud server, use it to check the share directly. In the example, replace SERVER with the SMB server’s NetBIOS name, SHARE with the share name and SMB_USER with your SMB account. Samba connection syntax

smbclient '//SERVER/SHARE' -U 'SMB_USER'

Enter the password if prompted, then type dir * in the SMB session to list files. Samba password prompt and directory listing

Fill in the SMB/CIFS mount form

Open the profile menu and choose Settings. Under Administration, select External Storage, then choose SMB/CIFS from Add storage. Admin mount form

In Authentication, choose Username and password for this example. That method sends the credentials entered for the mount to the storage backend. Authentication selector · Password-based authentication

An unrestricted admin mount is available to all users by default. Nextcloud saves the mount once all required fields are filled. Mount scope and automatic saving

Set Available for to the users or groups who need the mount. This example uses the Nextcloud group Team.

FieldExampleWhat to enter
Folder nameTeam FilesThe label users will see in Files. Use a name without slashes. Folder name
Hostfiles.example.testThe SMB server address. SMB/CIFS fields
ShareteamThe name of the existing share on that server. SMB/CIFS fields
Remote SubfolderprojectsA folder inside the share. Leave the field blank to mount the share root. Remote Subfolder
DomainBlank in this exampleUse this optional field if the server requires a domain and the chosen authentication method supplies a username you cannot edit. SMB domain
UsernameSMB_USERThe SMB account name. Use DOMAIN\SMB_USER if the server requires a domain-qualified username and you enter the username directly. SMB username
PasswordThe SMB account passwordEnter the password for that SMB account. SMB password

Match Case sensitive file system to the filesystem behind the share. This SMB option controls how Nextcloud looks up file names and validates paths. SMB case sensitivity

Choose how users authenticate

Authentication methodWhen to use it
Username and passwordUse one SMB account for the mount, as in the example above. Mount credentials
User entered, store in databaseLet each user enter their own SMB credentials before their first access to the mount. User-entered credentials
Log-in credentials, save in sessionUse this when the user’s Nextcloud login credentials also work on SMB. This mode disables sharing and background file scanning. Desktop and mobile clients that authenticate with tokens cannot access the mount, and the mode is unavailable with SAML/SSO. Session credentials and limits

For a photo archive on the Nextcloud server itself, see the Nextcloud and Immich pairing guide.

Verify access in Files

  1. Look for a green dot beside the mount in Administration → External Storage. Green means the mount is ready for use. Admin connection status
  2. Sign in as a member of Team, open Team Files in Files, and download a file. If users need write access, upload a file to the writable mount. External storage in Files
  3. If you sign in with an account outside the selected scope, Team Files should be absent. User and group permissions

Verify the connection with OCC

For the Username and password example on a manual Debian or Ubuntu install, start in the Nextcloud directory. Find the row for Team Files in the first command’s output and replace MOUNT_ID in the second command with the ID from that row. OCC runtime · List and verify mounts

sudo -E -u www-data php occ files_external:list
sudo -E -u www-data php occ files_external:verify MOUNT_ID

For AIO, run the same subcommands through the container. Replace MOUNT_ID with the ID returned by the first command. AIO OCC wrapper · List and verify mounts

sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ files_external:list
sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ files_external:verify MOUNT_ID

The verify command reports whether Nextcloud can connect using the mount configuration. Use the signed-in Files check to confirm access for the intended user. OCC mount verification · External storage in Files

For help identifying your installation type, see Nextcloud AIO vs Docker Compose vs Snap.

Fix an unavailable or missing mount

What you seeWhat to check
Red or yellow icon in the admin mount rowRecheck the SMB/CIFS configuration fields and network availability. Click the colored icon to retry. SMB/CIFS fields · Retry an external mount
Green in admin settings, missing from a user’s FilesIf the mount is restricted, check that Available for includes the user directly or through a group. User and group permissions · External storage in Files

Evidence and limits. The Nextcloud 35 administration and user manuals, Samba client manual and Nextcloud All-in-One README were checked on November 27, 2026. No hands-on testing was performed for this guide. The procedure covers adding an existing SMB share as secondary storage.

Sources

  1. External Storage · Nextcloud 35 Administration Manual docs.nextcloud.com
  2. SMB/CIFS · Nextcloud 35 Administration Manual docs.nextcloud.com
  3. Using external storage · Nextcloud 35 User Manual docs.nextcloud.com
  4. Using the occ command · Nextcloud 35 Administration Manual docs.nextcloud.com
  5. Files commands · Nextcloud 35 Administration Manual docs.nextcloud.com
  6. How to run occ commands · Nextcloud All-in-One github.com
  7. smbclient · Samba manual samba.org
  8. External Storage authentication mechanisms · Nextcloud 35 Administration Manual docs.nextcloud.com

Related