Skip to content

Personal folders over SMB: a section per account instead of [homes] (#183) - #184

Merged
UniqueDroid merged 8 commits into
mainfrom
fix/smb-homes
Nov 19, 2026
Merged

UniqueDroid merged 8 commits into
mainfrom
fix/smb-homes

Conversation

@UniqueDroid

@UniqueDroid UniqueDroid commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Fixes #183 (reported and analysed by Rambooka): personal folders could not be opened over SMB – \\box\<account> answered "The network name cannot be found", on every model.

Stacked on #182 (CHANGELOG.md, 0.3.0-beta.14) – merge #182 first, then this one.

Cause

write_smb() wrote Samba's [homes] with path = %H. ksmbd knows neither (checked in the ksmbd-tools 3.5.3 source: no homes, no % expansion, the share lookup is by exact name). The result was a share named homes on the path %H. The test only looked for the section in the file.

Fix

One section per account with a personal folder: path = /mnt/<volume>/home/<account>, valid users = <account>, browseable = no (ksmbd cannot show a share to one account only), masks 0600/0700. A share of the same name wins, so a workaround share keeps working.

What else turned up around the personal folders

Jan asked to look at everything that deals with them. Fixed here:

  • Names. A new share cannot take the name of an account with a personal folder; an account cannot get a personal folder while a share has its name (only checked when the folder is new for the account, so an account with a workaround share can still be edited).

  • Shares on home. A share on home itself listed everybody's folder names; a share on home/<something that is no account> made that folder as root:users 2775 – and an account of that name created later got it as its "personal" folder, open to the group. Now only home/<account> (on the volume of its personal folder) or a folder in it can be shared; .shareos cannot. Shares from older versions are left alone, but nothing is created for them in home.

  • Folders made for a share inside a personal folder belonged to root:users 2775; they are the account's now, 0700. Files written over SMB through such a share get 0600/0700 instead of 0664/2775.

  • User ids were reused. Deleting an account keeps its personal folder (the interface says so), and the next new account got the freed id – and with it the old folder and every file the old account left in shares. Ids are no longer given out twice (accounts.ids.last_uid; for boxes updated to this: nothing below the highest id in use).

  • A folder home/<name> that belongs to someone else was silently used as the personal folder of a new account of that name – which could then not open it (or, with a reused id, got the old account's data). Adding the account, or switching its personal folder on, is refused with a message that says whose folder it is.

  • An account whose personal folder is switched off kept it as home directory in /etc/passwd.

  • Moving the personal folder to another drive, or switching it off, happened without a word: the old folder stays, the account starts with an empty one, and the settings its apps keep there (cloud, Transmission, Syncthing) are missing. The dialog now asks first and says exactly that (two new texts, all nine languages). An account whose drive is gone or not mounted shows "drive not present" in the list.

Not in here: actually moving the data. Jan wants an assistant for the change to new disks (old disk over USB or over the network) that takes the personal folders along – a feature of its own.

Tests

tests/test-users.sh (ARM emulator): the section per account, no [homes]/%H, no section without a personal folder, the name refused, an existing share wins and comes back out, masks, the refused folders, homework allowed, the owner of a folder made in a personal folder, no account with the name of a share, a foreign folder not taken over, ids not reused, personal folder off and on. These could not be run here – this run is their first.

Not tried on a box and not with a real SMB client yet; docs/TESTING.md 14zw has the steps.


Generated by Claude Code

With signature checking on, the sentence about the signature sat in the
middle of the note and split its text into pieces that are in no
translation. Each sentence is an element of its own now, with its own
text in the catalogue (all nine languages, taken from the existing
translations of the whole note).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sb3gb1FHs6DNkZHKinKAJv
Found with a rendered check of System -> Firmware in every state and all
nine languages:
- the step shown while writing was one text with its ' …' and matched no
  translation ('Prüfunging the package again …'); the label is an element
  of its own now
- no error message of shareos-update, of the update part of the plugin and
  of shareos-flash-bin was in the catalogue: 33 texts and 20 patterns added,
  with all nine translations
- i18n.js: a value inside a pattern ($1 in 'Download: $1') is translated
  when it is a text of its own (several words, known as a whole or as a
  pattern), so the messages are translated behind a prefix too, and 'other
  firmware' in the dialogs

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sb3gb1FHs6DNkZHKinKAJv
test-storage failed on GitHub with 'mkswap: cannot open /dev/loop1p1: No
such device or address' (run 44358572104): partition() waited for the
node of the data partition only. Where the table is read again after
sfdisk has closed the disk, a partition is removed and added back; its
node is there, opening it fails. Wait until every new partition opens,
and try mkswap again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sb3gb1FHs6DNkZHKinKAJv
…183)

ksmbd knows neither [homes] nor %H (Samba), so \\box\<account> was never
found. write_smb writes one section per account with a personal folder:
valid users = <account>, not browseable, masks 0600/0700. A share of the
same name wins.

Around it, from a look at everything that deals with the personal folders:
- shares.set: a new share cannot take the name of an account with a
  personal folder; 'home', folders in it that are no account's and
  '.shareos' cannot be shared (home/<account> still can)
- ensure_folder: nothing is made in 'home' but folders inside the personal
  folder of an account, and those belong to the account (0700), not to
  root:users 2775
- a share on a personal folder writes files with 0600/0700
- shareos-users: no personal folder for an account with the name of a
  share; a folder home/<name> of someone else is not taken over; the uid
  of a deleted account is not reused (accounts.ids.last_uid); home
  directory '/' when the personal folder is off

Reported and analysed by Rambooka.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sb3gb1FHs6DNkZHKinKAJv
… off

The folder is not moved: the old one stays, the account starts empty on
the new drive, and what its apps keep there is missing. The dialog asks
first and says so; switching it off likewise. An account whose drive is
gone or not mounted shows 'drive not present'. Texts in all nine languages.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sb3gb1FHs6DNkZHKinKAJv
The run with the first fix got past mkswap and failed one step later:
'mdadm: cannot open /dev/loop2p2: No such device or address' (run
44374928238) – the first disk's partitions were gone again for a moment
while the second one was partitioned. wait_parts before mdadm --create,
mdadm --add and mkfs. test-storage prints the partitions, swaps and the
udev state when a setup fails.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sb3gb1FHs6DNkZHKinKAJv
The new check expected /bin/false for jan, who is an admin (run
44389057767: 188 passed, this one failed). The home directory is what it
is about.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sb3gb1FHs6DNkZHKinKAJv
@UniqueDroid
UniqueDroid marked this pull request as ready for review November 19, 2026 15:12
@UniqueDroid
UniqueDroid merged commit 8091cb0 into main Nov 19, 2026
7 checks passed
@UniqueDroid
UniqueDroid deleted the fix/smb-homes branch November 19, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Personal folders are not reachable over SMB – ksmbd has no [homes]/%H, so \\box\<user> is "network name cannot be found"

2 participants