Go Back    Forum > Digital Publishing / Web Sites > Web Hosting

LinkBack Thread Tools
01-10-2012, 01:43 AM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
Join Date: Feb 2004
Posts: 4,311
Thanked 376 Times in 342 Posts
Changing Exim to use another port is a trivial and quick task in SSH, and takes just a minute or two.

This will work with or without any panel, in any version of Linux, but know that this is being done in CentOS 5.6 32-bit with DirectAdmin, Exim 4, Dovecot, Roundcube and SquirrelMail. This is a typical managed Linux VPS from JaguarPC (an excellent host that's ranked highly on our suggested hosts list).

Why change ports? I was tired of the brute force attack emails being generated by DirectAdmin, so I disabled unnecessary mail services (POP3, SSL connections). At the same time, I wanted to keep webmail available, so I changed the SMTP port in Exim. ---- Note that we're not using POP3 on this VPS, just webmail and outgoing mail as generated by WordPress and vBulletin.

Brute force? There's always somebody that wants to hack your server. Common failed email login/username attempts include: sales, info, admin, administrator, help, webmaster, contact, john, james, sally, david, chris ... and lots of other common names. So if you're using a generic email account, or have a generic first name, you may want to change it to something else slightly more unique.

Anyway, this is how you change the port:

Step 1: Log in as root in SSH -- or su to root, if root logins have been disabled as a good admin should -- and use a text editor (like nano or vi) to edit the Exim config file. In this example, I'm using nano.

[root@vps]# nano /etc/exim.conf
The Exim conf file has probably 100 lines of "stuff" at the beginning of the file before it gets into the actual configuration options.
Tip: Make your Putty/SSH window full-screen, to see more. The default window is ridiculously tiny.

Step 2: Scroll down until you find this line with the port settings:

daemon_smtp_ports = 25 : 587
In the CSF (via the DirectAdmin plugin for CSF), I've already disallowed incoming requests to 25 and 587, so neither ports do anything anymore. I've opted to just change one of the ports (25). The other one (587) was left alone. I may add SSL later, and can change the port for it at that time, as well as open a hole in the firewall.

Step 3: Change "25" to your new port. Or change "587" to your new port, if you're using an alternate port (SSL). For example:

daemon_smtp_ports = 2525 : 587
Note: Because 2525 is a commonly scanned port, you'll want another number. Pick something unused and 4-digit.

^X (CTRL+X) to exit nano, Y to save, pick the same filename (exim.conf), and you'll be thrown back out to SSH.

Step 4: Restart Exim.

[root@vps]# service exim restart
Step 5: Don't forget to add the new port in CSF.

You should now be able to log into webmail (like Roundcube or SquirrelMail), yet have a port that is obscured enough to not be an easy target. Security by obscurity does work to some degree, and it should curtail the inbox filling warning messages from the brute force detection.

If you have any questions, or need any help, just post a reply here.

Hope this has helped.


Need a good host?
Find one here --> List of the Best Web Hosts in 2012 - Shared, reseller and VPS hosting

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts

Similar Threads
Thread Thread Starter Forum Replies Last Post
USB port connection problems, mouse and keyboard not found ty3 Computers 3 01-10-2012 01:54 AM
About the 2009 analog change (DTV, HDTV) Tranzor Videography: Cameras, TVs and Players 5 06-25-2008 12:28 PM
Anybody here know how to change your IP address? wayshway Computers 15 06-26-2006 11:13 PM

Thread Tools

All times are GMT -5. The time now is 06:17 PM