[Samba] netbios aliases ?

Simon Hobson shobson-lists at colony.com
Tue Sep 7 08:18:56 GMT 2004

At 5:37 pm +1000 7/9/04, ip.guy wrote:
>wow, not a single taker on this one !!!
>>hi all
>>I have a samba server acting as a domain member server providing 
>>file/print services to our SME
>>As i want to provide users with a list of available printers for 
>>installation, i need to give them a win32 shortcut to 
>>"\\samba-server\" so they can see the available printers and 
>>install as required BUT... doing so will also show them all of the 
>>available shares... not a major issue but would rather just list 
>>the printers (i am using "browseable = no" to hide all shares) but 
>>am now running into another problem.
>>I'm using a web interface to smbclient to allow staff to access the 
>>file server from home.
>>Making all shares inviable effectively makes the use of the web 
>>smbclient pointless
>>Is it possible to use a netbiios alias and force the printers to 
>>list under the alias ?
>>Any other suggestion welcome

Look up the %L substitution and include files.

You can do something along these lines :

         netbios name = fileserver
         netbios aliases = printers

         include = /etc/samba/smb.conf.%L

Your main smb.conf file contains ONLY the global section (and 
anything you specifically want to appear on each virtual server). You 
then have additional files in the form smb.conf.<servername> which 
contain the relevant shares for each server. You might have to 
experiment a bit with the case of the servername and include files, I 
can't remember whether takes the servername as written, or if any 
case conversion happens.

What happens is that when a client connects to any of the servers, 
Samba loads the smb.conf file as it starts the server process to 
handle the client. %L is substituted with the server name that the 
client connected to, and so the include statement will include the 
relevant file for the servername.

Downsides :

1) You can no longer administer the server with SWAT or Webmin. Later 
versions (of Webmin IIRC) warn you, earlier ones just write out a new 
smb.conf and leave you wondering where the f*** your shares just went 
- guess how I found out about that :-(

2) It doesn't work with pure IP - only with Netbios ? Hopefully 
someone else can fill in that one, I can only remember bits that have 
been on this list. I think it was something to do with the client not 
giving a server name when it connects directly with IP (on port 445 ?)

3) All the virtual servers have the same server comment.

4) I don't know if it's still recommended practice, or if it's 
something that's likely to stop working in the future.


Simon Hobson MA MIEE, Technology Specialist
Colony Gift Corporation Limited
Lindal in Furness, Ulverston, Cumbria, LA12 0LD
Tel 01229 461100, Fax 01229 461101

Registered in England No. 1499611
Regd. Office : 100 New Bridge Street, London, EC4V 6JA.

More information about the samba mailing list