Search code examples
network-programmingdnsubuntu-14.04samba

Ubuntu 14.04 wild card domains not working after uninstall of Samba


I am new to Ubuntu, I just switched to 14.04 a week ago. I installed LAMPP and used this http://ubuntuforums.org/showthread.php?t=1719832 and this http://brunodbo.ca/blog/2013/04/26/setting-up-wildcard-apache-virtual-host-wildcard-dns to set up a wildcard domain and virtual hosts to enable me test WordPress multi-site and everything worked fine. My site was running on http://mysite.loc. I tried to install Samba to share files with my colleagues on Windows. And it also worked fine for sometime. I tried using two tools with GUI(s) to configure Samba. I tried this https://apps.ubuntu.com/cat/applications/gadmin-samba/ and this https://apps.ubuntu.com/cat/applications/system-config-samba/, I noticed that the two applications were colliding when reading the smb.conf file. I was not able to start the Samba service and its daemon so I decided to unistall the applications along with Samba. So I used the following commands.

sudo apt-get auto-remove samba 
sudo apt-get purge samba
sudo apt-get purge winbind
sudo apt-get install winbind

now I cannot get my wildcard domains working. I can access localhost and 127.0.0.1 but I cannot access mysite.loc or *.loc which runs on 127.0.0.1 but on virtual hosts

This is my /etc/samba/smb.conf file

[global]
realm = 
netbios name = Samba24
server string = Samba file and print server
workgroup = WORKGROUP
security = ads
hosts allow = 127. 192.168.0.
interfaces = 127.0.0.1/8 192.168.0.0/24
bind interfaces only = yes
remote announce = 192.168.0.255
remote browse sync = 192.168.0.255
printcap name = cups
load printers = yes
cups options = raw
printing = cups
guest account = smbguest
log file = /var/log/samba/samba.log
max log size = 1000
null passwords = no
username level = 6
password level = 6
encrypt passwords = yes
unix password sync = yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
local master = yes
domain master = yes
preferred master = yes
domain logons = yes
os level = 80
logon drive = m:
logon home = \\%L\homes\%u
logon path = \\%L\profiles\%u
logon script = %G.bat
time server = yes
name resolve order = wins lmhosts bcast
wins support = yes
wins proxy = yes
dns proxy = no
preserve case = yes
short preserve case = yes
client use spnego = no
client signing = no
client schannel = no
server signing = no
server schannel = no
nt pipe support = yes
nt status support = yes
allow trusted domains = no
obey pam restrictions = yes
enable spoolss = yes
client plaintext auth = no
disable netbios = no
follow symlinks = no
update encrypted = yes
pam password change = no
passwd chat timeout = 120
hostname lookups = no
username map = /etc/samba/smbusers
passdb backend = tdbsam
passwd program = /usr/bin/passwd '%u'
passwd chat = *New*password* %n\n *ReType*new*password* %n\n *passwd*changed*\n
add user script = /usr/sbin/useradd -d /dev/null -c 'Samba User Account' -s /dev/null '%u'
add user to group script = /usr/sbin/useradd -d /dev/null -c 'Samba User Account' -s /dev/null -g '%g' '%u'
add group script = /usr/sbin/groupadd '%g'
delete user script = /usr/sbin/userdel '%u'
delete user from group script = /usr/sbin/userdel '%u' '%g'
delete group script = /usr/sbin/groupdel '%g'
add machine script = /usr/sbin/useradd -d /dev/null -g sambamachines -c 'Samba Machine Account' -s /dev/null -M '%u'
machine password timeout = 120
idmap uid = 16777216-33554431
idmap gid = 16777216-33554431
template shell = /dev/null
winbind use default domain = yes
winbind separator = @
winbind cache time = 360
winbind trusted domains only = yes
winbind nested groups = no
winbind nss info = no
winbind refresh tickets = no
winbind offline logon = no

[homes]
comment = Home Directories
path = /home
valid users = %U
read only = no
available = yes
browseable = yes
writable = yes
guest ok = no
public = no
printable = no
locking = no
strict locking = no

[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
read only = no
available = yes
browseable = yes
writable = no
guest ok = no
public = no
printable = no
locking = no
strict locking = no

[profiles]
comment = User Profiles
path = /var/lib/samba/profiles
read only = no
available = yes
browseable = yes
writable = yes
guest ok = no
public = no
printable = no
create mode = 0600
directory mask = 0700
locking = no
strict locking = no

[printers]
comment = All Printers
path = /var/spool/samba
browseable = yes
writable = no
guest ok = no
public = no
printable = yes
locking = no
strict locking = no

[pdf-documents]
path = /var/lib/samba/pdf-documents
comment = Converted PDF Documents
admin users = %U
available = yes
browseable = yes
writeable = yes
guest ok = yes
locking = no
strict locking = no

[pdf-printer]
path = /tmp
comment = PDF Printer Service
printable = yes
guest ok = yes
use client driver = yes
printing = bsd
print command = /usr/bin/gadmin-samba-pdf %s %u
lpq command =
lprm command =

Solution

  • It definitely sounds like you're only listening on localhost, so add your IP address from eth0 (or whichever interface you're using). Your config line:

    interfaces = 127.0.0.1/8 192.168.0.0/24
    

    is incorrect. 127.0.0.1/8 is a way to express both the IP and the subnet. 192.168.0.0/24 is a subnet declaration. Change the 192.168.0.0/24 to whatever your actual IP address is (/sbin/ifconfig) and restart samba.

    You may want to read the Networking Options with Samba section to familiarize yourself with the hosts allow and hosts deny options as well