Files
sharestead/docs/system-requirements.md
tandClaude Opus 5.5 8dabb0bd16 Subfolder permissions: own access for a folder inside a share (F-DIR-9)
A subfolder (e.g. Family/Finances) can get its own list of users and groups
with Read or Read & write; nobody else gets in. Users can be set to No access
to keep them out of a listed group. The share's own access still applies.

How it works:
- POSIX ACLs on the subfolder and everything inside, with the same entries as
  default ACL so new files inherit them. The kernel enforces them, so SMB, NFS
  and local access behave the same (ADR-10).
- The subfolder is given to root (group kept), so whoever created it doesn't
  keep owner rights to it.
- The share's create mask / directory mask get group rw / rwx when missing
  (journaled smb.conf change, shown in the review). Samba's default 0744
  becomes the ACL mask of new files and capped every named user at read:
  reproduced with Samba 4.22 on CT 151; "inherit acls = yes" did not help.
- ACLs are written in the kernel's xattr format by internal/adapters/aclfs
  (bytes checked against what setfacl stores). The walk uses an os.Root,
  skips symlinks, and opens each item with openat + O_NOFOLLOW from its
  parent: a share user swapping in a symlink can't redirect the root process.
  setfacl -R isn't used because it works on paths. os.Root.OpenFile followed a
  symlink despite O_NOFOLLOW (found by a test), hence the explicit openat.
- The ACLs on disk are the source of truth and are read back on every load;
  hand changes are listed per subfolder. The app settings only list which
  subfolders have rules.
- Removing a rule gives the tree what the folder above gives (its default
  ACL, else its permission bits).
- Refused: personal folders, guest shares (force user), storage without ACLs
  (greyed out with the reason and a "Why?" link to the limitation), rules
  inside or above another rule (v1), more than 32 entries.
- The ACL change is recorded in the history (audit, not undoable; the review
  says so); the smb.conf part is undoable as usual.

API: GET/PUT/DELETE /api/v1/shares/{name}/subfolders (PUT/DELETE with
?dry_run=1). UI: "Subfolders with their own access" card on the share page.

Tested: unit tests from acl(5)/kernel bytes (domain/acl 98%), service tests on
real ACLs in a temp dir (92%), adapter (85%), API via the harness, 16 mutants
all caught; e2e on CT 151 (desktop + phone); smbclient checks on CT 151 (ZFS
with ACLs; no-ACL dataset refused) and VM 152 (XFS, ext4; virtiofs refused).
Total coverage 76.8% (minimum raised to 76.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 17:58:38 +01:00

6.6 KiB

System requirements and what each feature needs

Sharestead works in the basic case on any supported system. Some features need more from the system (or from the Proxmox host). Sharestead checks this itself: the System page shows, per storage folder, what works, and features that can't work are greyed out with the reason and what would have to change.

Always needed

What Requirement
Operating system Debian 12 or 13, Raspberry Pi OS 64-bit; amd64 or arm64
Where a VM, bare metal, or an LXC container (privileged or unprivileged)
Packages installed automatically with the .deb: samba, smbclient, acl
Memory 512 MB for the whole container in small setups
Network clients reach port 445/tcp (SMB) and 8443/tcp (web UI)

Features with extra requirements

Feature Needs Without it
Different access for subfolders (e.g. Family/Finances only for alex) POSIX ACLs on that storage folder (see below) access per share only; the option is greyed out with the reason
Read-only per user over NFS POSIX ACLs on that storage folder NFS gives access per device; the share page says which rules NFS doesn't enforce
NFS nfs-kernel-server; a privileged container or a VM (the kernel NFS server can't run in an unprivileged container) NFS is shown as not available, with the reason
Hard storage limits (writes stop at the limit) set in the filesystem: a ZFS dataset with refquota, an XFS/ext4 project quota per folder. In a container only the host can set them. Sharestead shows them as the folder's size personal folders get a soft limit: measured every ~10 min, read-only over SMB until space is freed; it can grow past the limit in between, NFS isn't limited
Soft limit per share nothing extra: Sharestead measures the folder and stops uploads over SMB when it is full — (available everywhere; writes on the server itself or over NFS aren't stopped; it counts space on disk after compression)
Windows network discovery wsdd2; ports 3702/udp, 5357/tcp the NAS doesn't appear in Network on Windows; connecting by address still works
Mac discovery avahi-daemon; port 5353/udp the NAS doesn't appear in Finder's sidebar; Connect to Server still works
TVs and media players (DLNA) minidlna; ports 1900/udp, 8200/tcp no DLNA
Storage from the Proxmox host in an unprivileged container the host folder belongs to the container's mapped IDs (container ID + 100000) Sharestead says that the folder's owner doesn't match and that this is fixed on the host

POSIX ACLs: check and enable

ACLs add permissions for more users and groups than "owner, one group, others". Sharestead needs them only for subfolder permissions.

Filesystem ACLs
ext4, xfs, btrfs on by default
ZFS off by default (acltype=off)
ZFS in a Proxmox container's own disk on (Proxmox enables it)
ZFS dataset mounted into a container from the host as set on the host, usually off
storage mounted over NFS/SMB from another device (e.g. an old NAS) usually not available

Enable on ZFS (on the host, as root, once per dataset):

# on the Proxmox host (root)
DATASET=tank/share
zfs set acltype=posix xattr=sa "$DATASET"

✅ Check: in Sharestead, System → Run all checks → the storage folder shows ACLs: yes. No restart needed: a running container sees the change right away (tested with a ZFS dataset mounted into a Proxmox container).

Existing files keep their permissions; Sharestead offers to add matching ACLs to existing shares.

Subfolder permissions: what to know

Set on the share page → Subfolders with their own access. Only the users and groups listed get into the subfolder; the share's own access still applies on top.

Topic Behaviour
Protocols enforced by the filesystem, so the same for SMB, NFS and anything on the server
Existing files get the new permissions when the rule is saved (can take a while for many files)
The share's create masks Sharestead gives new files group read & write (create mask, directory mask), shown in the review; without it, people with Read & write couldn't change each other's new files
Owners whoever owns a file inside keeps owner rights to it
Programs that change permissions (e.g. a Mac with Unix permissions over SMB, chmod on the server) can narrow a single file; saving the rule again repairs it
Not possible personal folders, guest shares, a rule inside or above another rule

Protocols don't all enforce the same rules

Access is set once per share and applies to every protocol. But protocols differ:

Protocol Who it checks Notes
SMB the logged-in user everything Sharestead offers
SFTP, WebDAV (planned) the logged-in user same rules as SMB; they run as that user, so subfolder ACLs hold
NFS the device (IP/network); the user ID the device sends is trusted only for devices you trust (Proxmox, media server, Linux PCs). Per-user rules need ACLs and still rely on the device telling the truth

The share page lists, for each enabled protocol, what it enforces and what not.

Switching services without the UI

Sharestead reads the service state from systemd, so scripts and tools like Ansible can switch services directly; the UI shows the result.

Service systemd unit
SMB smbd
NFS nfs-server
Windows discovery wsdd2
Mac discovery avahi-daemon
NetBIOS (old devices) nmbd
DLNA minidlna
# on the Sharestead system (root)
UNIT=nfs-server
systemctl disable --now "$UNIT"   # switch off
systemctl enable --now "$UNIT"    # switch on

✅ Check: the Services page shows the new state.

Hard limit per folder: examples

The limit then shows up in Sharestead (and on PCs) as the folder's size.

# on the machine that owns the filesystem (for a container: the Proxmox host), as root
DIR=/srv/data/family   # the share's folder
ID=42                  # any free project number
SIZE=500g

# XFS (mounted with the prjquota option)
xfs_quota -x -c "project -s -p $DIR $ID" -c "limit -p bhard=$SIZE $ID" "$(df --output=target "$DIR" | tail -1)"

# ext4 (created with -O quota,project, mounted with prjquota)
chattr -p $ID +P "$DIR"
xfs_quota -f -x -c "limit -p bhard=$SIZE $ID" "$(df --output=target "$DIR" | tail -1)"

# ZFS: the folder is its own dataset
zfs set refquota=$SIZE tank/family

✅ Check: df -h "$DIR" shows the limit as the size. On ext4, root may write past it; Samba users can't.