
A common problem after installing a service is testing if it correctly works. This could be done using different command-line tools that sends data in raw mode allowing system administrator to see exactly what comes back.
This cheat-sheet shows how to use command-line tools to pinpoint the connection problems:
Port 21
How to login and execute commands on ftp server:
$ telnet domain.tld 21
Trying domain.tld...
Connected to domain.tld.
Escape character is '^]'.
220 ProFTPD 1.3.1 Server ready.
user username
331 Password required for username
pass password
230 User username 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 domain.tld 25
Trying domain.tld...
Connected to domain.tld.
Escape character is '^]'.
220 localhost ESMTP Postfix (Ubuntu/GNU)
HELO domain.tld
250 localhost
MAIL FROM: root
250 2.1.0 Ok
RCPT TO: <email@domain.tld>
250 2.1.5 Ok
DATA
354 End data with .
Subject: Email from domain.tld
From: domain.tld
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 domain.tld...
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 domain.tld...
Connected to domain.tld.
+OK Hello There
user username
+OK Password required.
pass 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 domain.tld...
Connected to domain.tld.
Escape character is '^]'.
* OK Dovecot ready.
a login email@domain.tld e
a OK Logged in.
a examine inbox
a logout
* BYE Logging out
a OK Logout completed.
Port 993
To debug IMAP over SSL:
openssl s_client -connect domain.tld:993
then use same commands as port 143 example.
Port 995
To debug POP3 over SSL:
openssl s_client -connect domain.tld:995
then use same commands as port 110 example.