Ubuntu – Cannot open samba ports on Ubuntu 14.04

firewallUbuntuufw

I'm newbie to linux firewalls

root@Ubntu:~# ufw status verbose
state: active
logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
new profiles: skip
137,138/udp (Samba)        ALLOW IN    Anywhere
139,445/tcp (Samba)        ALLOW IN    Anywhere
22                         ALLOW IN    Anywhere
80                         ALLOW IN    Anywhere
137,138/udp (Samba (v6))   ALLOW IN    Anywhere (v6)
139,445/tcp (Samba (v6))   ALLOW IN    Anywhere (v6)
22 (v6)                    ALLOW IN    Anywhere (v6)
80 (v6)                    ALLOW IN    Anywhere (v6)

ufw allow samba (or http) – does nothing, port stays closed
ufw allow ssh – opens ssh port
ufw disable – only ssh port is open

according netstat samba server is listening on:

tcp        0      0 127.0.0.1:139           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:445           0.0.0.0:*               LISTEN 

I assume that some other firewall rules forbid access.

Please help troubleshoot the problem

PS tried to clear iptables firewall rules with no luck:
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

Best Answer

The problem is that your samba server is listening only to localhost interface. You need to have the following in your smb.conf:

[global]
    interfaces = eth0
    bind interfaces only = yes

This way Samba will listen to eth0 interface, so that connections coming from the network are accepted.

Related Topic