ksmbd: resolve symlinks in share paths before writing ksmbd.conf#61
Open
ispyisail wants to merge 2 commits into
Open
ksmbd: resolve symlinks in share paths before writing ksmbd.conf#61ispyisail wants to merge 2 commits into
ispyisail wants to merge 2 commits into
Conversation
ksmbd's kernel module returns NT_STATUS_ACCESS_DENIED when a share root path is a symlink. The 'Same folder on all disks' / 'The Same Partition On Any USB Drive' option stores the dev-based symlink path (e.g. /tmp/usb_mount/dev_sda1) rather than the UUID-based real path, causing all shares configured with that option to be inaccessible. Resolve the path via readlink -f in smb_add_share before writing it to ksmbd.conf so ksmbd always receives a real directory path.
The PR accidentally changed ksmbd.init from 755 to 644, likely due to a local git core.fileMode mismatch. Init scripts on OpenWrt must be executable for procd and direct service invocations to work. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ispyisail
commented
Jun 27, 2026
ispyisail
left a comment
Author
There was a problem hiding this comment.
The readlink -f "$path" 2>/dev/null || echo "$path" pattern is correct — it resolves symlinks, suppresses errors when the path does not exist yet (e.g. drive not yet mounted at init time), and falls back to the original path safely.
One bug introduced: the diff includes a file mode change on ksmbd.init from 100755 → 100644. Init scripts need to be executable or service ksmbd start/stop/restart and procd invocations break. This looks like a local core.fileMode mismatch rather than an intentional change.
Fixed in the branch with git update-index --chmod=+x.
ispyisail
pushed a commit
to ispyisail/gargoyle
that referenced
this pull request
Jun 27, 2026
dhcp.sh, restriction.sh, qos_download.sh, and qos_upload.sh were committed as 100644. Uhttpd invokes these as CGI executables and returns 403 if the executable bit is absent. Same core.fileMode root cause as ksmbd.init in lantis1008#61. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ispyisail
pushed a commit
to ispyisail/gargoyle
that referenced
this pull request
Jun 27, 2026
dhcp.sh, restriction.sh, qos_download.sh, and qos_upload.sh were committed as 100644. Uhttpd invokes these as CGI executables and returns 403 if the executable bit is absent. Same core.fileMode root cause as ksmbd.init in lantis1008#61.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ksmbd's kernel module returns
NT_STATUS_ACCESS_DENIEDwhen a shareroot path is a symlink. The "Same Partition On Any USB Drive" option
in the USB Storage page stores the dev-based symlink path
(e.g.
/tmp/usb_mount/dev_sda1) rather than the UUID-based real path,causing all shares configured with that option to be inaccessible.
Confirmed on hardware: connecting via smbclient to a share with a
symlink root returns
NT_STATUS_ACCESS_DENIED; resolving the pathfirst gives a successful directory listing.
Add
readlink -finsmb_add_shareafter reading the path from UCIso ksmbd always receives a real directory path. The fallback
|| echo "$path"preserves the original path if the target does not yet exist (drive
not plugged in).