Brian Kelsay wrote:
Gerald Combs wrote:
bam:/home/gerald> telnet kclug.org 25 Trying 139.146.133.42... Connected to kclug.org. Escape character is '^]'. 220 kclug.org ESMTP Postfix (Debian/GNU) quit 221 Bye Connection closed by foreign host.
Umm, why is telnet running/responding on the server?
I'm not sure if telnet is running on the server, but Postfix is responding on port 25. Most telnet clients allow you to specify a port number after the host name. If you specify a non-standard port from Telnet's perspective (not 23), the telnet client just opens a direct ("raw") connection (normally it tries to exchange environment information upon connecting). At this point you're just pushing bytes at the server, like any other TCP client. Since a bunch of popular TCP protocols are text-based, this means you can interact with the server manually.
This has several uses, including the ability to apply Occam's razor in a troubleshooting situation. If someone is having trouble connecting to a web server, you can run
---- bam:/home/gerald> telnet www.cnn.com 80 Trying 64.236.16.52... Connected to www.cnn.com. Escape character is '^]'. HEAD / HTTP/1.0 Host: www.cnn.com
HTTP/1.1 200 OK Server: Netscape-Enterprise/6.1 AOL Date: Fri, 27 Aug 2004 04:13:04 GMT Last-modified: Fri, 27 Aug 2004 04:13:05 GMT Expires: Fri, 27 Aug 2004 04:14:05 GMT Cache-control: private,max-age=60 Content-type: text/html Content-length: 0 Connection: close
Connection closed by foreign host. ----
In this case, we know that CNN is up, so we might want to start looking for problems on the browser end.
Other examples:
POP ---- xxxx:/home/gerald> telnet xxxxxxx 110 Trying xxxxxxxxxx... Connected to xxxxxxx. Escape character is '^]'. +OK POP3 xxxxxx 2003.85 server ready user xxxxxx +OK User name accepted, password please pass xxxxxx +OK Mailbox open, 1188 messages quit +OK Sayonara Connection closed by foreign host. ----
NNTP ---- bam:/home/gerald> telnet news-server.kc.rr.com 119 Trying 24.94.170.87... Connected to news-server.kc.rr.com. Escape character is '^]'. 200 Powered By Twister - Road Runner - Kansas City, MO (Twister v2.0.6.342) group rec.bicycles.tech 211 2322 335670 338086 rec.bicycles.tech quit 205 GoodBye Connection closed by foreign host. ----