Skip to content

Samba: Add option to disable NetBIOS (nmbd) - #4705

Merged
agners merged 10 commits into
home-assistant:masterfrom
atx32:master
Jul 15, 2026
Merged

Samba: Add option to disable NetBIOS (nmbd)#4705
agners merged 10 commits into
home-assistant:masterfrom
atx32:master

Conversation

@atx32

@atx32 atx32 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Added config option and associated files to allow user to disable nmbd service startup. NetBIOS is not needed to access SMB shares with current operating systems. Added parameter to config.yaml and implemented the enable/disable function by adding an enable-check.sh script and associated Dockerfile variable.

Description of netbios config parameter taken from #4468 since this text had already been reviewed. Made other updates to documentation to include a full sample config and update listing order.

I did not bump the revision number or add to the changelog but can do that if needed.

Summary by CodeRabbit

  • New Features
    • Added a new NetBIOS over IP setting for the Samba add-on to enable or disable NetBIOS.
    • When NetBIOS is disabled, the NetBIOS service is no longer started and access is restricted to SMB on port 445 (with port 139 blocked).
    • Updated “local master” behavior so it depends on whether NetBIOS is enabled.
  • Documentation
    • Refreshed the Samba share configuration guide with updated YAML examples and expanded descriptions for workgroup, NetBIOS, and local master.

atx32 added 6 commits July 2, 2026 18:28
This script enables or disables the nmbd service based on the configuration setting.
Added netbios configuration for legacy SMB clients and reworded local_master description.
Reworded the 'local_master' option section and added details about the 'netbios' option, including its purpose and default value.
Updated sample configuration to include missing items and reordered some descriptions.

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @atx32

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
home-assistant Bot marked this pull request as draft July 3, 2026 15:34
@home-assistant

home-assistant Bot commented Jul 3, 2026

Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@atx32
atx32 marked this pull request as ready for review July 3, 2026 15:36
@home-assistant
home-assistant Bot dismissed their stale review July 3, 2026 15:36

Stale

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6f4cb06c-e464-4edf-8866-02b8802fc510

📥 Commits

Reviewing files that changed from the base of the PR and between 5df5e12 and 29a784b.

📒 Files selected for processing (5)
  • samba/CHANGELOG.md
  • samba/config.yaml
  • samba/rootfs/etc/s6-overlay/scripts/enable-check.sh
  • samba/rootfs/usr/share/tempio/smb.gtpl
  • samba/translations/en.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • samba/rootfs/etc/s6-overlay/scripts/enable-check.sh
  • samba/translations/en.yaml

📝 Walkthrough

Walkthrough

Adds a configurable NetBIOS toggle to the Samba add-on, conditionally manages the nmbd service and port configuration, and updates the schema, translations, changelog, and documentation.

Changes

Samba NetBIOS toggle

Layer / File(s) Summary
NetBIOS configuration and nmbd startup
samba/config.yaml, samba/Dockerfile, samba/rootfs/etc/s6-overlay/scripts/enable-check.sh, samba/CHANGELOG.md
Adds the netbios option, wires the s6 stage hook to create or remove the nmbd service marker, and records the resulting service and port behavior.
Port and option wiring
samba/rootfs/usr/share/tempio/smb.gtpl, samba/translations/en.yaml
Conditionally emits the smb ports = 445 directive and groups local_master under the NetBIOS translations.
Configuration documentation
samba/DOCS.md
Updates the YAML example and documents workgroup, netbios, and local_master settings.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Config
  participant EnableCheck
  participant Nmbd
  participant SambaTemplate
  Config->>EnableCheck: read netbios
  EnableCheck->>Nmbd: create or remove service marker
  Config->>SambaTemplate: provide netbios value
  SambaTemplate->>Nmbd: allow or omit port 445 directive
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a Samba option to disable NetBIOS and prevent nmbd from starting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@samba/Dockerfile`:
- Around line 22-24: The S6 stage2 hook script referenced by the Dockerfile is
not executable, so startup will fail with a permission error. Update the Docker
image setup around the ENV for S6_STAGE2_HOOK and the enable-check.sh script so
that samba/rootfs/etc/s6-overlay/scripts/enable-check.sh is installed with
execute permissions (or explicitly chmodded) before the container starts, and
keep the hook path aligned with the script being run directly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 98a2dd9f-7cf2-4ad7-a165-076eea4b7548

📥 Commits

Reviewing files that changed from the base of the PR and between 7bbc888 and 8bce084.

📒 Files selected for processing (5)
  • samba/DOCS.md
  • samba/Dockerfile
  • samba/config.yaml
  • samba/rootfs/etc/s6-overlay/scripts/enable-check.sh
  • samba/translations/en.yaml

Comment thread samba/Dockerfile
@atx32
atx32 marked this pull request as draft July 3, 2026 15:47
@atx32
atx32 marked this pull request as ready for review July 3, 2026 16:01

@agners agners left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

I did not bump the revision number or add to the changelog but can do that if needed.

Yes, please also bump the version in config.yaml and add an entry to CHANGELOG.md.

Comment thread samba/config.yaml
Comment thread samba/rootfs/etc/s6-overlay/scripts/enable-check.sh Outdated
@home-assistant
home-assistant Bot marked this pull request as draft July 10, 2026 21:17
@atx32
atx32 marked this pull request as ready for review July 12, 2026 15:20
@home-assistant
home-assistant Bot requested a review from agners July 12, 2026 15:20
@atx32

atx32 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Should all be good now. I would not consider changing the netbios default to false until mDNS advertising is implemented.

@agners agners left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@agners

agners commented Jul 15, 2026

Copy link
Copy Markdown
Member

Should all be good now. I would not consider changing the netbios default to false until mDNS advertising is implemented.

There is also wsdd implemented now. Shouldn't that make the Samba server discoverable for almost all Windows systems already? 🤔

@agners
agners merged commit e5cf38a into home-assistant:master Jul 15, 2026
8 checks passed
@atx32

atx32 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

There is also wsdd implemented now. Shouldn't that make the Samba server discoverable for almost all Windows systems already? 🤔

For Windows I agree. But in some other cases (VLC on FireOS as a personal example) shares aren't discoverable without nmbd running or the service advertised with mDNS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants