What is the most effective way to check Samba server availability from a Linux client?
Asked
Active
Viewed 2,778 times
1
1 Answers
2
As the comment suggests, test to see if the port is open. But instead of "telnet", using "nc" to just test if the port is open is much easier to check the result:
nc -z remotehost 139 && echo up || echo down
PBI
- 311
-
Thanks @PBI your advice is much more convenient than, what I used: nmap -p $port $ip | grep --quiet -e "^[0-9][/tcpudp ]closed" :) – atevm Feb 01 '16 at 13:31
-
I thought the port was 445 and not 139 https://techcommunity.microsoft.com/t5/storage-at-microsoft/smb-alternative-ports-now-supported-in-windows-insiders/ba-p/3974509 – Valerio Bozz Nov 10 '23 at 15:18
telnet <remotehostname> 139ornmap -p 139 <remotehostname>should do it. For telnet if you get the message 'telnet: Unable to connect to remote host: Connection refused' then the host does not expose samba to you. see more info on how to test port TCP\139 here: http://superuser.com/questions/769541/is-it-possible-to-ping-an-addressport – Frank Thomas Jan 28 '16 at 14:44