I am trying to connect to a linux server which is set up as shares in samba. I am able to ssh and ping to the samba server, but when I attempt to map the drive through windows it says "Windows cannot access \ip\example.

Given that I could ssh to it tells me that the problem comes from the nmb side of things... I have restarted smb, nmb and also iptables, but still unable to connect.

*$iptables -S
-A INPUT -p icmp -j ACCEPT 
-A INPUT -i lo -j ACCEPT 
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT 
-A INPUT -j REJECT --reject-with icmp-host-prohibited 
-A FORWARD -j REJECT --reject-with icmp-host-prohibited* 

testparm smb.conf results below:

*$testparm -s /etc/samba/smb.conf 

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[printers]"
Processing section "[data]"
Processing section "[Xerox]"
Loaded services file OK.
                server string = Samba Server Version %v
                log file = /var/log/samba/log.%m
                max log size = 50
                idmap config * : backend = tdb
                cups options = raw

                comment = All Printers
                path = /var/spool/samba
                printable = Yes
                print ok = Yes
                browseable = No

                comment = Data
                path = /data
                admin users = root
                read only = No
                create mask = 0770
                force create mode = 060
                security mask = 0770
                force directory mode = 0770

                comment = Colour
                path =
                printable = Yes
                print ok = Yes*

I have read the post here but it seems to be a different scenario. Any suggestions are welcome.


With the firewall rules included in the question, you're allowing ICMP (which includes but is not limited to "ping") and SSH but reject everything else.
Ie, you're rejecting the SMB/CIFS related traffic.

Allowing 137/udp, 138/udp, 139/tcp, 445/tcp should help.

| improve this answer | |
  • uh! Thanks for the input @Håkan Lindqvist ! In my iptables I've added -A RH-Firewall-1-INPUT -p udp -m udp --dport 137 -j ACCEPT -A RH-Firewall-1-INPUT -p udp -m udp --dport 138 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT right before the rules with -j REJECT, but I get the error iptables: Applying firewall rules: iptables-restore: line 11 failed [FAILED]. What else could be wrong? – SplitInf Nov 23 '16 at 17:04
  • Turns out -A RH-Firewall-1-INPUT is syntax from centos5. Starting from centos6 simply using -A INPUT would do the job. Many thanks again.discussion link – SplitInf Nov 24 '16 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.