Say you have brand new Ubuntu server with a few Samba shares (and Avahi for auto-discovery). Or perhaps you have upgraded your existing server to 17.10 or 18.04 LTS.
You open up Nautilus or Finder (or if you are unlucky, File Explorer) to test your Samba shares, and what do you see? Your meticulously chosen server name is in now in ALL CAPS. (Note that I haven’t confirmed this in File Explorer.)
This aggression will not stand (man).
Fast forward to 2017, when this integration was re-enabled, first in Debian then in Ubuntu. This meant Samba in Ubuntu 17.10 and onward would register with Avahi by default, and Samba likes its server names uppercase.
(NetBIOS names are case-insensitive but, apparently by convention, are always converted to uppercase before being used, including in this case being passed to Avahi.)
Can I have my server name back now?
The good news is that Samba 4.8.0 added an option,
mdns name, that when set to
mdns should restore sanity to your advertised server name.
The bad news is that the 4.8 series isn’t available in the default repositories yet. Ubuntu 18.10 will likely ship with 4.8, but LTS users may have to wait until the next LTS release.
Another approach would be to disable the default integration, then manually register a service with Avahi with the correct name.
To disable the default integration with Avahi, add this option to the global section of
multicast dns register = no
And to manually register a service with Avahi, add a
.service file to
/etc/avahi/services/samba.service) with this content:
<?xml version="1.0" standalone='no'?> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h</name> <service> <type>_smb._tcp</type> <port>445</port> </service> <service> <type>_device-info._tcp</type> <port>0</port> <txt-record>model=Xserve</txt-record> </service> </service-group>
This also includes a stanza to set the icon displayed in Finder, for the professional touch.
Note that, as Bryan Henry pointed out on the Ubuntu bug report, this disables any dynamic Avahi support in Samba, for instance advertising certain shares as being Time Machine-compatible. But as Time Machine support was added in Samba 4.8, this isn’t such a big loss. I suggest adding a note in
smb.conf to undo this workaround when you upgrade to 4.8.
I know you’ll agree, all that effort was totally worth it.