Invoking `smbclient -L localhost` in Ubuntu gives: NT_STATUS_CONNECTION_REFUSED

I have Ubuntu Intrepid with Samba installed on my machine. I have a basic configuration file included below.

When I try to invoke

smbclient -L localhost

I get the error:

NT_STATUS_CONNECTION_REFUSED

This also happens when trying to invoke smbpasswd.

What are the possible causes of this error?

When I run both:

iptables -L
iptables -t nat -L

They are both empty.

Here is my config file (Running testparm reports that it's ok):

[global]
   workgroup = MSHOME
   server string = %h server (Samba, Ubuntu)
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   encrypt passwords = true
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user
   usershare allow guests = yes
[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no

Solution 1:

I don't see an interface definition. I think your issue is that the service simply isn't bound to the loopback address, so when you connect, you're rejected.

Try adding this to your [global] section of your smb.conf file:

interfaces = ${your-ip-address}/{your-subnet-in-dotted-quad} 127.0.0.1/255.0.0.0

Solution 2:

The server wasn't even running.

It seems in Ubuntu 9.04, the init.d scripts are broken.

If the /etc/default/samba config file has:

RUN_MODE="inetd"

set, then the init.d script will fail to start smbd. So just set the variable to:

RUN_MODE="daemons"

or delete that file entirely, and it will work fine.