Fix authentication issue on mail server with Telnet

Q I am trying to fix an authentication issue with my mail server, and the only way I have been to test it is by setting it up in Evolution. Is there any way that I could try without having to set an account in Evolution?

A One of the best ways to test a range of different services, including SMPTP SAUTH, is to use Telnet. Now, I would never recommend normal Telnet to log in to a machine, but for testing some services it is invaluable. To trouble shoot your problem, what we want to do is to connect to the mail server on port 25 and authenticate using the encoded base 64 (read about it at http://en.wikipedia.org/wiki/Base64). First, a few helpful decoded strings, encoded with www.dillfrog.com/tools/base-64_encode:

'VXNlcm5hbWU6' decodes to
'Username:'
'UGFzc3dvcmQ6' decodes to
'Password:'
'dGVzdF9seGZAcmV6ZC5jby51aw==' decodes to 'test_lxf@rezd.co.uk'
'Zm9vYmFy' decodes to 'foobar'

The following lines are the dialogue to test the server is authenticating. We use base 64 encoding for some of the strings, which are detailed above. First, Telnet to the mail server domain/IP address (ie mail.rezd.co.uk or 10.0.0.1) on port 25:

telnet 10.0.0.1 25

The server will answer with an SMTP banner:

Trying 10.0.0.1...
Connected to mail.rezd.co.uk
(10.0.0.1).
Escape character is '^]'.
220 mail.rezd.co.uk ESMTP

Issue the EHLO command:

EHLO other.domain.rezd.org.uk

Next, the server tells us what it supports. This can very from mail server to mail server.

250-mail.rezd.co.uk Hello other.
domain.rezd.org.uk [192.168.0.1],
pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-AUTH DIGEST-MD5 CRAM-
MD5 LOGIN PLAIN
250 HELP

Authenticate to the mail server with

AUTH LOGIN

It sends out the username prompt:

334 VXNlcm5hbWU6

Now we send the name of a user that we are going to authenticate with, eg test_lxf@rezd.co.uk:

dGVzdF9seGZAcmV6ZC5jb20=

Next it asks for the password:

334 UGFzc3dvcmQ6

And we supply it:

Zm9vYmFy

And finally it says yes, so we know that authentication is working:

235 2.0.0 OK Authenticated

If we get the following, we know that there is an issue with the authentication in some way:

535 5.7.0 authentication failed

This is sufficient to test authentication; if we wanted to test sending mail we could continue the SMTP dialogue.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar