Windows – Can ssh and ping but cannot map to SAMBA drive

mappeddrivesambasshwindows

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
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
-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 role: ROLE_STANDALONE
[global]
                server string = Samba Server Version %v
                log file = /var/log/samba/log.%m
                max log size = 50
                idmap config * : backend = tdb
                cups options = raw

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

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

[Xerox]
                comment = Colour
                path = 142.20.216.47
                printable = Yes
                print ok = Yes*

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

Best Answer

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.