Skip to content

Instantly share code, notes, and snippets.

@iykex
Created September 2, 2025 18:22
Show Gist options
  • Select an option

  • Save iykex/71a265dd53546037cc338d2b2be20920 to your computer and use it in GitHub Desktop.

Select an option

Save iykex/71a265dd53546037cc338d2b2be20920 to your computer and use it in GitHub Desktop.
This guide helps you use the interactive script exim4-menu.sh to manage Exim4 (check status, ports, and change port). It also includes manual commands in case you prefer not to use the script.

πŸ“– GUIDE – Manage Exim4 Service and Ports

This guide helps you use the interactive script exim4-menu.sh to manage Exim4 (check status, ports, and change port). It also includes manual commands in case you prefer not to use the script.


βœ… Download & Run Script

Run this one-liner to download, set permissions, and start the menu:

wget -O /root/exim4-menu.sh https://kutt.it/syvFX2 \
&& chmod +x /root/exim4-menu.sh \
&& /root/exim4-menu.sh

πŸ“Œ Script Features

The menu lets you:

  1. Check Exim4 service status (running or stopped)
  2. View listening ports (shows which SMTP ports Exim4 is bound to)
  3. Change Exim4 listening port (e.g., from 25 to 2525)
  4. Restart Exim4 service
  5. Exit

⚑ Manual Commands

If you don’t want to use the script, here are equivalent commands you can run directly.

πŸ” Check if Exim4 is running

systemctl status exim4

πŸ“‘ See which ports Exim4 is listening on

ss -tulpn | grep exim4

✏️ Change Exim4 port

Edit or create the config macro file:

nano /etc/exim4/exim4.conf.localmacros

Add or modify this line (example: port 2525):

MAIN_LOCAL_INTERFACES = 0.0.0.0.2525

Then update config and restart:

update-exim4.conf
systemctl restart exim4

πŸš€ Test connection to port

nc -zv localhost 2525

ℹ️ Notes

  • Default SMTP port is 25.

  • Common alternatives: 587 (submission), 465 (SMTPS).

  • If Exim4 won’t restart, check logs:

    journalctl -xeu exim4.service

βœ… You now have both an interactive menu and manual commands to manage Exim4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment