Debugging server services with telnet



Test webserver with telnet

Telnet is a raw connection. This commandline tool could be used to debug different types of server services. Using telnet allows you to send anything untranslated, and see exactly what comes back.

Post describes how to use telnet for unusual purposes.

Port 21

How to login and execute commands on ftp server:

$ telnet ip.add.re.ss 21
Trying ip.add.re.ss...
Connected to ip.add.re.ss.
Escape character is '^]'.
220 ProFTPD 1.3.1 Server ready.
user your_ftp_user
331 Password required for riverplantationcc
pass your_ftp_password
230 User your_ftp_user logged in
help
214-The following commands are recognized (* =>'s unimplemented):
214-CWD     XCWD    CDUP    XCUP    SMNT*   QUIT    PORT    PASV
214-EPRT    EPSV    ALLO*   RNFR    RNTO    DELE    MDTM    RMD
214-XRMD    MKD     XMKD    PWD     XPWD    SIZE    SYST    HELP
214-NOOP    FEAT    OPTS    AUTH    CCC*    CONF*   ENC*    MIC*
214-PBSZ    PROT    TYPE    STRU    MODE    RETR    STOR    STOU
214-APPE    REST    ABOR    USER    PASS    ACCT*   REIN*   LIST
214-NLST    STAT    SITE
quit
221 Goodbye.

Port 25

How to send an email:

$ telnet ip.add.re.ss 25
Trying ip.add.re.ss...
Connected to ip.add.re.ss.
Escape character is '^]'.
220 localhost ESMTP Postfix (Ubuntu/GNU)
HELO domain.tld
250 localhost
MAIL FROM: root
250 2.1.0 Ok
RCPT TO: <your@email_addre.ss>
250 2.1.5 Ok
DATA
354 End data with .
Subject: Email from ip.add.re.ss
From: ip.add.re.ss

Test data
.
250 2.0.0 Ok: queued as 7C3F68464C1
quit
221 2.0.0 Bye

Port 80

How to retrieve a webpage:

telnet domain.tld 80
Trying ip.add.re.ss...
Connected to domain.tld.
Escape character is '^]'.
HEAD / HTTP/1.1
Host: domain.tld

HTTP/1.1 200 OK
Date: Thu, 12 Nov 2009 10:41:18 GMT
Server: Apache
Last-Modified: Wed, 01 Apr 2009 15:02:13 GMT
ETag: "b8c6a-73-4667f99bca740"
Accept-Ranges: bytes
Content-Length: 115
Vary: Accept-Encoding,User-Agent
Content-Type: text/html

Port 110

How to check email account for new messages:

$ telnet domain.tld 110
Trying ip.add.re.ss...
Connected to domain.tld.
+OK Hello There
user your_pop3_user
+OK Password required.
pass your_pop3_password
+OK Logged in.
stat
+OK a b
quit
+OK goodbye

Port 143

How to login to a IMAP server:

telnet domain.tld 143
Trying ip.add.re.ss...
Connected to domain.tld.
Escape character is '^]'.
* OK Dovecot ready.
a login email@addre.ss your_password e
a OK Logged in.
a CAPABILITY
* CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS AUTH=PLAIN AUTH=LOGIN
a OK Capability completed.
a logout
* BYE Logging out
a OK Logout completed.