Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Samba server shows up twice in macOS network #135

Closed
nazgul6 opened this issue Jul 6, 2024 · 6 comments
Closed

Samba server shows up twice in macOS network #135

nazgul6 opened this issue Jul 6, 2024 · 6 comments

Comments

@nazgul6
Copy link

nazgul6 commented Jul 6, 2024

First, great image, been running great in an unprivileged LXC on Proxmox for months now:). Thanks for maintaining!

One question- on my macs, I see my samba server come up twice - once, expectedly, as the 'Time Capsule' with the avahi name I set, and then once more as a 'PC' with the hostname of the LXC container where I run this docker image. How can I get rid of the latter please?

This is what I see:
Screenshot 2024-07-06 at 08 06 07
FWIW, they actually both connect, but I'd rather not have the PC one there.

This is my docker compose (without account / shares lines).

services:
  samba:
        build: .
        image: ghcr.io/servercontainers/samba
        container_name: samba_ghcr
        restart: no
        network_mode: host
        cap_add:
           - CAP_NET_ADMIN
        environment:
           MODEL: 'TimeCapsule'
           AVAHI_NAME: lynx
           #NETBIOS_DISABLE: 1
           #WSDD2_DISABLE: 1
           #AVAHI_DISABLE: 1
           SAMBA_CONF_LOG_LEVEL: 3
           SAMBA_GLOBAL_STANZA: "load printers = no; printing = bsd; printcap name = /dev/null; disable spoolss = yes; min protocol = SMB2; vfs objects = acl_xattr catia fruit streams_xattr; fruit:nfs_aces = no; inherit permissions = yes; fruit:model = MacSamba; fruit:posix_rename = yes; fruit:veto_appledouble = no; fruit:wipe_intentionally_left_blank_rfork = yes; fruit:delete_empty_adfiles = yes; fruit:metadata = stream"

I am not using external avahi.

Thanks!

@MarvAmBass
Copy link
Member

Hi there,

thanks for raising this issue - I have exactly the same problem - I didn't check, if the docker-samba PC entry comes from zeroconf. I suspect that macos finder has multiple ways to find it's services.

I just checked using the App ZeroScan and found no zeroconf entry for my PC Name - only for my AVAHI Name.

Imagine you buy some crappy cheap hardware which serves it's files using samba - some wifi enabled survilance cam or whatever - from a customer point of view you want it to show up in your devices, even if they didn't implement zeroconf - so finder might do port scanning etc.

@nazgul6
Copy link
Author

nazgul6 commented Jul 6, 2024

Thanks for the speedy reply. I was half hoping a solution would be a specific permutation of NETBIOS_DISABLE and WSDD2_DISABLE options, but I guess it's not that.

I also don't see the docker-samba PC anywhere else - I checked an iOS app, Windows PC, even another macOS app (Forklift). Also, I can't ping it from macOS terminal either.

@MarvAmBass
Copy link
Member

sure maybe you find a solution - if so let me know in this issue :)

@nazgul6
Copy link
Author

nazgul6 commented Jul 6, 2024

I think I figured it out - It's NetBIOS on port 445 that advertises using the DNS hostname of the server.

If you sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.netbiosd.plist on the Mac, the 'PC' will immediately disappear from Network. If you run sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.netbiosd.plist it will come back after 15-30 seconds or so. Tested this twice.

So the solution seems to be to add 'NETBIOS_DISABLE: 1' to the samba docker environment and then also unload and re-load the netbios plist on the Mac using the above two commands. This is because the previously discovered NetBIOS services seem to be a bit sticky and don't drop off (and flushing the DNS cache doesn't flush those at all.) It's been 10min+ now and it hasn't come back yet (even after docker LXC restart).

See if you can replicate? :)

Reading:
https://www.oreilly.com/openbook/samba/book/ch04_04.html
https://support.apple.com/en-us/102050

@MarvAmBass
Copy link
Member

thanks so much! interessting fact - when I started with this container I didn't start the nmbd I ran into issues - so maybe it's needed for certain things

@MarvAmBass
Copy link
Member

I've updated https://github.com/ServerContainers/samba/blob/master/TROUBLESHOOTING.md file with your infos - thanks!

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

No branches or pull requests

2 participants