无法在Ubuntu 14.04上打开samba端口

我是新手到Linux防火墙

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允许samba(或http) – 什么也不做,端口保持closuresufw允许ssh – 打开ssh端口ufw禁用 – 只有ssh端口打开

根据netstat samba服务器正在侦听:

 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 

我假设其他一些防火墙规则禁止访问。

请帮助解决问题

PS试图清除iptables防火墙规则,没有运气:iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -Pinput接受iptables -P FORWARD接受iptables -P OUTPUT ACCEPT

问题是你的samba服务器只听localhost接口。 你需要在你的smb.conf有以下内容:

 [global] interfaces = eth0 bind interfaces only = yes 

这样Samba将监听eth0接口,以便接受来自networking的连接。