Skip to content
Syno Package Land
Language: English

Keep files in a Shared Folder

A package can keep files in a DSM Shared Folder instead of its data folder; the installer picks (select) or creates (create) one and writes the folder name for your app.

Terminal window
synopkgland init -t native-go --shared-folder select my-app

init takes --shared-folder select|create, --shared-folder-name (create only), --shared-folder-key (default shared) and --shared-folder-permission ro|rw (default rw).

In dsm-package.yaml:

install:
sharedFolder:
# select or create
mode: select
# the name your app reads the folder by
key: media
# ro or rw: the access the package account needs
permission: rw
# create only: the Shared Folder to create
# name: my-app-data
FieldRule
modeselect or create
key^[a-z][a-z0-9_]{0,31}$; no pkgwizard_, synopkg or change_ prefix
permissionro or rw
namecreate only, forbidden with select. ^[A-Za-z0-9][A-Za-z0-9_-]{0,31}$; system names such as homes, users, volume1 or usbshare1 are refused

install.sharedFolder declares the folder; install.settings declares the install-wizard inputs (see Manifest). One Shared Folder per project.

ModeInstall wizardUpgrade wizard
selectThe NAS’s Shared Folders and a permissions noteThe current folder stays unless the administrator checks the change box
createA note that the package creates name and grants the package account the permission; an existing folder is kept and only the permission is setThe same note

With select, DSM grants no access to the chosen folder; an administrator adds the package account (the package’s name) in Control Panel > Shared Folder, Permissions > System internal user. Until then your app reports it as not readable.

With create, uninstalling never deletes the Shared Folder or its files.

The installer writes config.json to the app’s data folder with the folder name, not its path:

{"schema":1,"shared_folders":{"media":"my-share"}}

The Go template resolves the volume path each time, so a moved folder keeps working. Read it with Config.SharedFolders(), or app.ReadSharedFolders and app.ResolveSharedFolder; each reports key, name, path, exists, readable and writable under the DSM ACL. app.status returns them as shared_folders (or shared_folders_error for a damaged config.json) and is administrator-only by default; set "app.status": "authenticated" in backend/internal/api/permissions.json for all signed-in users.

Compose apps check the selected bind-mount folders as the package account before starting containers; missing read or write permission stops startup and names the share, package account and Control Panel remedy. Installation can finish first, but the first start still checks; selecting a folder grants nothing.

An admitted DSM launch can show a localized, dismissible permission dialog while the gateway is stopped. Retry only rechecks access; after granting it, start the app in Package Center. It changes no ACLs and starts nothing. An SDK frontend can reuse SharedFolderPermissionDialog; a pass is advisory, since later ACL changes and child-file permissions can still fail I/O.

LimitValue
Declarations per package1
Key1 to 32 characters
Created folder name1 to 32 characters
init --shared-foldernative-go template only
Permission for the package accountro or rw
Symptom or codeCauseFix
STANDALONE_SHARED_FOLDER_INVALIDA field breaks a rule aboveFix install.sharedFolder
INIT_SHARED_FOLDER_INVALIDInvalid init --shared-folder value or templateFix the option; use -t native-go
readable or writable is falseThe package account lacks accessGrant ro or rw in Control Panel > Shared Folder
exists is false, shared folder not found on any volumeNo volume has that folderCheck that it still exists
The error names more than one volumeTwo volumes have that folderRename one folder

See Errors for every code.