0

This question already has an answer here:

I have ssh access to my Linux server and I want to check whether port 25 open or not.

I discussed with hosting service provide and they said port 25 is open.

I checked using PHP script for port 25 and it says it is open.

I want to know how to check using command on linux server like in Windows I can use telnet example.com 25

Any idea?

marked as duplicate by Eric Carvalho, karel, Charles Green, Videonauth, Elder Geek Nov 15 '17 at 16:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Does telnet example.com 25 not work for you? – dobey Nov 13 '17 at 9:02
  • I was testing on linux server, I didn't got response after telnet, so I thought it is for only windows. – shahab Nov 13 '17 at 12:05
0

You should check it from your home PC or another computer than your Linux server. you can use several tools like telnet, curl, netcat (nc) etc.

curl:

$ curl ip_or_domain:25

netcat:

$ nc ip_or_domain 25

in any case if you got 220 hostname SMTP Mail Server this shows that the port is open.

  • When I am doing then getting error as "curl: (7) Couldn't connect to server" and nc mydomain.com 25 shows no output – shahab Nov 13 '17 at 12:15
  • nc doesn't print out information to stdout but you could check its response like nc ip_or_domain 25 && echo $? if it is 0=> success, if not => failure – derHugo Nov 13 '17 at 17:41
  • @shahab82 what is the output of curl ip_or_domain 25 -v? – Ghasem Pahlavan Nov 13 '17 at 21:51

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