Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can't connect to file shares on Windows computers using smbclient -L //hostname when the firewall is enabled.

This occurs whether I'm using ufw (which allows outgoing traffic and replies back in with the default configuration) or iptables (where I'm allowing outgoing traffic and replies back in with iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT).

However, smbclient -L //ip-address works whether the firewall is enabled or not.

I also tested this against a Samba server running on Ubuntu and again smbclient -L //hostname does not work when the firewall is enabled, but smbclient -L //ip-address works whether the firewall is enabled or not.

For reference, here are the iptables rules I used during testing:

-A INPUT -p icmp -j ACCEPT 
-A INPUT -d -p udp -m udp --dport 5353 -j ACCEPT 
share|improve this question
your dns lookup dosn't work. what happens when you try host <your-smb-host>? And what is in your /etc/resolv.conf ? – schneehase Mar 6 '11 at 16:29

I was having a similar problem: I didn't had samba installed but I wanted to browse the network with smbclient and I couln't get no servers in my network, but with the firewall down I could see all the servers.

After searching I found out that ufw (my firewall) wasn't loading the nf_conntrack_netbios_ns module.

I've edited the file /etc/default/ufw, added the module in the line IPT_MODULES=, restarted the firewall with no ports open and voilá, I could browse the samba shares in my network :)

More people had this issue and a bug was opened in ufw about it:

Hope this helps.

share|improve this answer

Turn off the firewall; you have blocked the SMB packets from the other machine trying to tell you its name.

share|improve this answer
Thanks, psusi, but how can I get this working without turning the firewall off? – user8979 Mar 9 '11 at 20:27
@skyblue: open the correct ports, though if you aren't blocking any otherwise open ports, then what exactly is the firewall doing? A firewall that only blocks ports that are not open anyhow is kind of pointless. What are you actually trying to block with the firewall? – psusi Mar 9 '11 at 21:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.