0

I am trying to set up netbios aliases in Samba on Ubuntu 12.04 LTS (2:3.6.3-2ubuntu2).

My primary share (not on the aliases) work fine. The shares on the aliases can be listed but fail when connecting with the following error:

param/loadparm.c:9114(process_usershare_file) process_usershare_file: stat of /var/lib/samba/usershares/usersx failed. No such file or directory

I get a "permission denied" if I create the above file.

When I connect with smbclient -U% //serverh/users I get:

tree connect failed: NT_STATUS_BAD_NETWORK_NAME

My samba config smb.conf and related alias configs smb-%L.conf have no mention of anything usershare related, and I understand that usershares are disabled when the settings are the default, so why it is the only thing mentioned in the log is a mystery.

Here is sample of one of the (many, many) variants of the config I have tried:

smb.conf

[global]
netbios name = ServerC
netbios aliases = ServerO ServerH
workgroup = CC
server string = %h server (Samba, Ubuntu)
interfaces = 192.168.0/24 10.10.10.0/24 eth0
log file = /var/log/samba/log.%m
max log size = 4000
syslog = 0
map to guest = Bad user
create mask = 0775
directory mask = 0775
security = user
encrypt passwords = true
guest account = nobody
usershare allow guests = yes
wins support = yes
local master = yes
preferred master = yes
os level = 65
include = /etc/samba/smb-%L.conf

[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
guest ok = yes
read only = yes

The non-working config:

smb-serverh.conf

[global]
workgroup = CC
netbios name = ServerH
map to guest = Bad User
guest ok = Yes
create mask = 0775
directory mask = 0775
security = user

[users]
comment = "Server H Users"
path = /var/local/samba/serverh/users
nt acl support = No
guest ok = yes
force group = sambashare

The config for the working alias:

smb-serverc.conf

[global]
workgroup = CC
netbios name = ServerO
map to guest = Bad User
guest ok = Yes
create mask = 0775
directory mask = 0775
security = user

[data]
comment = "Server C Data"
path = /var/local/samba/serverc/data
read only = no
nt acl support = No
guest ok = yes
force group = sambashare

I found a number of suggestions on what may be the issue, but none have availed. The serverh/users directory exists and I have run chmod 775 -R serverh and chown nobody:sambashare serverh on it. Same permissions as the Server C. I am not using selinux but I ran echo 0 > /selinux/enforce. When I put the users share into the smb-serverc.conf file I have no problem accessing it.

Samba is acting as if the directory did not exist, but it clearly does (since it works in the serverc config), and as if usershares were enabled (but they are not mentioned in the config), and in any case the shares cannot be accessed although the config follows what appears to be the simplest case for netbios aliases.

I'm at a loss and any assistance would be most appreciated.

1 Answer 1

0

The solution was found in the 2008 article Samba: IP Alias Servers On Debian.

To prevent bitrot, here are the salient points:

Add IP aliases to /etc/network/interfaces

... 
iface eth0 inet static
address 10.10.10.10
netmask 255.255.255.0

iface eth0:1 inet static
address 10.10.10.11
netmask 255.255.255.0
auto eth0:1

iface eth0:2 inet static
address 10.10.10.12
netmask 255.255.255.0
auto eth0:2

Bring the aliases up with ifup eth0:1; ifup eth0:2. Don't forget to add these lines to e.g. /etc/rc.local if that's how you bring up your interfaces.

Configure name lookups

I am using dnsmasq, so I just had to add the hosts to my /etc/hosts file like this:

10.10.10.10 serverc
10.10.10.11 serverh
10.10.10.12 servero

It may be necessary to delete or edit the name lookup caches /var/lib/samba/wins.dat and/or /var/cache/samba/browser.dat. If the network cache is poisoned more effort may be needed.

Update Samba config

smb.conf: Change the include line from /etc/samba/smb-%L.conf to /etc/samba/%i.conf.

Then symlink the IP aliases config to the respective config like this:

ln -s smb-serverc.conf 10.10.10.10.conf
ln -s smb-serverh.conf 10.10.10.11.conf
ln -s smb.servero.conf 10.10.10.12.conf

Edit each of these configs to add the respective interfaces = line i.e.

  • smb-serverc.conf: interfaces = eth0
  • smb-serverh.conf: interfaces = eth0:1
  • smb-servero.conf: interfaces = eth0:2

Don't forget to remove any interfaces = from smb.conf since those could really muck things up.

Run service smbd restart and service nmbd restart and off to the races.


A less convoluted alternative is to set smb ports = 139 and then the NetBios name will work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .