Skip to main content

Files

File manager for shares, datasets and /appdata: upload, download, rename, move, copy, delete, owner and permissions.

The Files page works directly on the NAS filesystem, as root. It is meant for administrative tasks (create folders, repair permissions, quickly upload or download a file); for everyday work with many files, the SMB and NFS shares are the better choice.

Locations​

Choose the location at the top left. Only these are offered:

KindSource
Apps/appdata (the app directories)
Sharethe path of every SMB/NFS share
Datasetevery mounted ZFS dataset whose path is not already a share
Remote mountevery mounted remote mount below /mnt/remotes whose path is not already a share

System paths (/, /etc, /usr, /var, /root, /boot, /proc, /sys, /dev, /run, /tmp and more) are never locations. The directory /appdata/bunkerbox (Bunkerbox itself with sessions and credentials) is hidden and cannot be reached through a path either. Remote mounts in the state "waiting" (automount not triggered yet) are not offered so that opening them cannot hang.

The page address contains location and folder (/files?root=share:media&path=filme) and can be bookmarked.

Security​

  • Every path is passed as a location plus a relative path; every component must be a valid name (no /, no . or .., no control characters).
  • Starting at the location, Bunkerbox checks every component with lstat: every folder on the way must be a real folder, symbolic links are never followed, not even in the last part (files are opened with O_NOFOLLOW). In addition, the real path (realpath) of the parent folder must equal the displayed path. So neither .. nor a link created by a share user can lead out of the location.
  • Symbolic links are shown but can neither be opened nor downloaded; copying copies them as links.
  • Downloads are always delivered as attachments with Content-Type: application/octet-stream and a sandbox CSP, so uploaded HTML files never run in the context of the interface.
  • Uploading is a streamed request to /api/files/upload. This route checks login, second factor and origin (Origin) itself, because the Next.js access proxy would buffer large requests in memory and cut them off after 10 MB.
  • All changing actions are recorded in the audit log (files.*).

View​

The table shows name, size, modification time, owner:group and permissions (rwxr-x---, octal as tooltip). Click a heading to sort, folders always come first; the filter field searches the current folder. More than 5000 entries in one folder are cut off. On narrow screens only name and size are shown. The view refreshes every 15 s.

Actions​

ActionBehaviour
New foldertakes over owner, group and permissions (including setgid) of the parent folder
Uploadchoose files or drop them onto the table; one file after the other with progress, can be cancelled. The file is first written as a hidden partial file and only placed under its name once it is complete; cancelled transfers leave nothing behind. New files take over owner and group of the folder and its read/write permissions (without execute). If the name exists, the list asks to Replace or Skip. Folders cannot be uploaded. Bunkerbox checks the free space first; on the system disk at least 1 GiB or 5 % stay free. If no data arrives for 5 minutes, the upload is aborted
Downloadfiles directly (click the name), folders as a ZIP file created while downloading (uncompressed, ZIP64 for large files; symbolic links and special files are left out)
Renamewithin the same folder; an existing name is never overwritten
Move, copyinto any folder of any location. Existing files of the same name are only overwritten with Replace, folders never. Copies keep owner, group, permissions and modification time (ACLs and extended attributes are not copied); copied into another location, they belong to the owner and group of the target folder. setuid and setgid of files are never copied. Moving within one dataset is instant; between datasets the data is copied and the original deleted afterwards
Deletefiles after confirmation, folders only one at a time and after typing the folder name. If a folder contains another mounted filesystem (e.g. a dataset), deleting is refused up front
Owneruser and group from /etc/passwd and /etc/group, for folders optionally for all content
Permissionsread/write/execute for owner, group and others plus setuid, setgid and sticky, also as an octal value. Recursively, folders get exactly these permissions; files only get execute if they already were executable (like chmod X), setuid/setgid are not set on files

Copying, moving, deleting and recursive changes run in the background and show their progress under Operations; while they run (and while uploads run), Bunkerbox refuses updates. Recursive changes and deleting never enter other mounted filesystems. All operations work through opened folders (/proc/self/fd): if someone replaces a folder with a symbolic link over SMB or NFS meanwhile, it has no effect outside the location.

The file manager does not set a share's permissions (ACLs). If they got mixed up, apply them again under Shares.

A location itself (e.g. the folder of a share) cannot be renamed, moved or deleted.

API​

MethodPathDescription
GET/api/files/rootsFileRoot[]
GET/api/files/list?root=&path=DirectoryListing
GET/api/files/stat?root=&path=FileEntry
GET/api/files/principalsusers and groups for the owner dialog
GET/api/files/download?root=&path=file or ZIP stream
POST/api/files/upload?root=&path=&name=&overwrite=1raw file content as body, header x-bunkerbox-upload: 1 -> 201 FileEntry
POST/api/files/mkdir, /api/files/renameCreateFolderRequest, RenameRequest
POST/api/files/move, /api/files/copyTransferRequest -> 202 FileOperation
POST/api/files/deleteDeleteFilesRequest -> 202 FileOperation
POST/api/files/chown, /api/files/chmodChangeOwnerRequest, ChangeModeRequest -> 202 FileOperation
GET/api/files/operations, /api/files/operations/[id]running and recent operations (the last 50, in memory)

Test mode​

With BUNKERBOX_MOCK=1 the simulated paths (/tank/media, /tank/documents, /appdata, …) live in a sandbox folder data/mock-files/ that is filled with example files on first use. All actions really work there; owner and permissions are only simulated (this also works on Windows). Delete the folder to reset it.