DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Disable Sendmail Listening on Port 25 on Linux

Step-by-step instructions for disabling Sendmail's public port-25 listener on Oracle Linux 7 and M4-managed Linux systems, with loopback MSA options and verification commands.
Length8 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To stop Sendmail accepting inbound SMTP on TCP port 25, remove or disable the daemon socket that binds the SMTP service, then regenerate the configuration, restart Sendmail, and verify both IPv4 and IPv6 listeners. On Oracle Linux 7, the documented switch is DAEMON=no in /etc/sysconfig/sendmail. On M4-managed installations, remove the MTA DAEMON_OPTIONS declaration from the .mc source. If local applications still need to submit mail, retain a loopback-only MSA on port 587 rather than exposing port 25.

What disabling port 25 actually changes

Sendmail opens an incoming socket when it runs in daemon mode. The daemon normally uses SMTP port 25, and each DAEMON_OPTIONS occurrence can create another listening socket. The Port, Addr, and Family fields determine the port, bind address, and address family.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Removing the MTA socket prevents remote SMTP clients from connecting to this host on port 25. It does not, by itself, remove every way to submit or deliver mail. Sendmail can still be used for local submission, queue processing, and outbound delivery, depending on the remaining configuration and how the service is started. The -bd daemon mode is the part associated with accepting connections on socket 25; message delivery and queue operation are separate modes.

There are two common end states:

  • No incoming Sendmail sockets: remove the MTA listener and any MSA listener you do not need.
  • Local submission only: remove the public MTA listener, disable the automatically generated MSA if necessary, and add an MSA on port 587 bound only to 127.0.0.1, ::1, or both.

Identify how your distribution manages Sendmail

Do not apply the Oracle setting to every Linux distribution. First determine whether the package exposes a distribution startup file or builds sendmail.cf from an M4 source file.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Oracle Linux 7 startup configuration

Oracle Linux 7 documents a setting in /etc/sysconfig/sendmail. In that file, DAEMON=no disables Sendmail daemon startup, which prevents it from listening for incoming mail on port 25. This is a distribution-specific control, so inspect the installed file and the package documentation before changing it.

M4-managed configuration

Many installations maintain an editable .mc file and generate the active sendmail.cf from it. In this model, the .cf file is generated output. Editing only that output can be lost the next time the package rebuilds the configuration. Make the durable change in the .mc source, then regenerate and install the resulting sendmail.cf using the procedure supplied by your distribution.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Look in the package’s Sendmail configuration directory for the active .mc and .cf files, and check the service unit or init script to learn which generated file is loaded. File locations and restart commands differ between distributions; the socket and M4 rules are the same.

Option 1: disable the daemon on Oracle Linux 7

  1. Open /etc/sysconfig/sendmail with an administrator account.
  2. Set the daemon switch to exactly DAEMON=no. Preserve unrelated variables in the file.
  3. Save the file and restart Sendmail using the service-management command used by your Oracle Linux installation.
  4. After the restart completes, verify the listening sockets with the checks in the verification section below.

This switch disables daemon startup rather than selectively changing one generated DAEMON_OPTIONS line. It is appropriate when the host should not accept incoming SMTP at all. If local software must submit mail through an MSA on port 587, use the M4 approach instead, or confirm that your package provides a separate supported MSA configuration.

Option 2: remove the MTA listener in an M4 configuration

Remove the standard SMTP declaration

Sendmail’s configuration documentation identifies the default MTA declaration as:

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
DAEMON_OPTIONS(`Port=smtp, Name=MTA')

Delete or comment out that MTA declaration in the .mc source when no inbound SMTP socket should exist. The documentation states that omitting the first MTA DAEMON_OPTIONS line leaves no listener on the standard SMTP port. Remove every equivalent public MTA declaration, not just the first line you notice; each remaining declaration can create another socket.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not confuse the MTA declaration with an MSA declaration. An MTA normally receives server-to-server mail on port 25. An MSA normally accepts mail submissions from trusted local clients on port 587. They are separate listener definitions.

Prevent an unwanted automatically generated MSA

If you want no Sendmail listener at all, add this feature to the .mc source:

FEATURE(`no_default_msa')

FEATURE(`no_default_msa') prevents automatic generation of the default MSA entry. Use it when removing the MTA line is not enough because the generated configuration would otherwise still create an MSA socket.

Keep local submission on port 587

For a host that needs local applications to submit messages but must not expose SMTP publicly, combine FEATURE(`no_default_msa') with explicit loopback-only MSA declarations. A typical pattern is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
FEATURE(`no_default_msa')
DAEMON_OPTIONS(`Port=587,Addr=127.0.0.1, Name=MSA')
DAEMON_OPTIONS(`Port=587,Addr=::1, Name=MSA')

Use only the address families your system needs. The IPv4 entry accepts connections through the IPv4 loopback address; the IPv6 entry accepts connections through the IPv6 loopback address. Neither binds a public interface. If applications use only one family, retaining only that loopback declaration reduces unnecessary sockets.

The exact option spelling and surrounding lines must match the syntax already used in your package’s .mc file. Keep authentication, access-control, and submission policy settings that your local clients require; changing the bind address alone does not create a complete application policy.

Regenerate, install, and restart safely

  1. Back up the current .mc source and generated sendmail.cf so you can restore a known-good configuration.
  2. Edit the source file: set DAEMON=no for the Oracle Linux 7 startup-file method, or remove the MTA declaration and adjust MSA features in the M4 method.
  3. Build a new sendmail.cf from the edited .mc file with the M4 build command documented by your installed Sendmail package.
  4. Install the generated file in the location loaded by the service. Do not assume that the directory used by one distribution is correct for another.
  5. Restart Sendmail through the package’s service manager. A restart is required; editing a source file does not change sockets held by an already running daemon.
  6. Check the service status and logs for a configuration or syntax error before testing from a remote system.

If the generated file fails to build, restore the backup and correct the M4 syntax before restarting. A partially written or invalid configuration can prevent Sendmail from starting, while an old running process may continue to hold port 25 until it is stopped.

Verify that port 25 is closed on every address family

Inspect all TCP listeners

Run:

ss -ltnp

Review the local-address column for any listener using :25. A public IPv4 listener commonly appears as 0.0.0.0:25 or as a specific non-loopback IPv4 address. A public IPv6 listener appears as [::]:25 or a specific non-loopback IPv6 address. Either one means the host can still accept connections on port 25 through that address family.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Confirm the intended submission sockets

If you retained local submission, the only expected Sendmail listener should be the loopback address or addresses you deliberately configured, such as 127.0.0.1:587 and/or [::1]:587. A wildcard address on port 587 is not loopback-only and should be treated as a separate exposure that requires an intentional decision.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Check the owning process

The process column from ss -ltnp should identify the Sendmail daemon for any remaining Sendmail socket. If another process owns port 25, changing Sendmail will not remove that listener. Investigate the owning service separately before declaring the port closed.

Test from outside the host when remote access matters

A local socket listing tells you what the kernel has bound, while an external connection test confirms what a remote network can reach. Test both an IPv4 route and an IPv6 route when the host has both. A firewall can block a reachable service, but a firewall rule alone does not prove that Sendmail stopped listening; the authoritative local check is the absence of a port-25 socket.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why common attempts do not work

Blocking port 25 only in a firewall

A firewall rule can prevent selected traffic while Sendmail continues to listen. That leaves an unnecessary daemon socket, may permit traffic from an allowed interface, and can obscure the actual service state. Remove the MTA listener in Sendmail’s configuration first, then use firewall policy as an additional network control.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Editing only the generated .cf file

Generated files can be replaced during a package update or a later M4 rebuild. If the MTA line returns after regeneration, the source .mc file still declares it. Make the source change permanent and treat the generated file as build output.

Stopping the service without changing startup configuration

A one-time stop removes the current process but does not prevent the service from returning after a reboot or package action. Use the supported startup switch or source configuration, then restart and verify the result.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Removing the MTA but forgetting IPv6

Administrators often check only 0.0.0.0:25. A separate IPv6 declaration can leave [::]:25 active, and Sendmail creates an incoming socket for each daemon declaration. Always inspect both address families.

Removing every MSA entry when local mail is still needed

FEATURE(`no_default_msa') is correct when no MSA should exist, but it also removes the automatically generated MSA. If local programs submit through port 587, add explicit loopback-bound MSA declarations after disabling the default. Otherwise those programs may fail even though remote SMTP is correctly blocked.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Assuming a successful restart proves the port is closed

Sendmail can restart successfully while a different daemon declaration still binds port 25, or while another process owns the port. Use ss -ltnp after every configuration change and identify all remaining listeners.

Choose the approach that matches the requirement

Approach Configuration point Port-25 result Local submission Persistence considerations
Oracle Linux 7 daemon switch /etc/sysconfig/sendmail with DAEMON=no Sendmail daemon does not start to accept incoming SMTP Not established by this switch; verify the package’s separate submission behavior Uses the distribution’s startup configuration; inspect it after package changes
M4 source without MTA declaration Remove the MTA DAEMON_OPTIONS line from the .mc source No standard SMTP listener is generated from that declaration Only if an MSA remains or is explicitly added Survives regeneration when the source file is maintained
M4 source with loopback MSA Disable the default MSA and add port-587 entries bound to 127.0.0.1 and/or ::1 No public port-25 listener Yes, for clients using the configured loopback address Regenerate and reinstall from the maintained .mc source
Firewall-only block Network firewall rules May block traffic, but Sendmail can still listen Depends on the firewall rule and listener configuration Does not change Sendmail’s daemon configuration

Operational checklist

  • Identify whether the host uses Oracle Linux 7’s startup file or an M4-managed configuration.
  • Back up the active source and generated configuration.
  • Disable the daemon with DAEMON=no, or remove every public MTA declaration from the .mc source.
  • Decide explicitly whether an MSA is required. Add only loopback-bound port-587 sockets when local submission must remain.
  • Regenerate and install sendmail.cf using the installed package’s procedure.
  • Restart Sendmail and inspect status or logs for errors.
  • Use ss -ltnp to confirm that neither public IPv4 nor public IPv6 has a :25 listener.
  • Confirm that any remaining :587 listener is limited to the intended loopback address.
  • Repeat the verification after upgrades or configuration rebuilds, because generated files and service defaults can change.

Final answer

The durable fix is to change Sendmail’s daemon configuration, not merely to filter port 25. On Oracle Linux 7, set DAEMON=no in /etc/sysconfig/sendmail. On an M4-managed system, remove the MTA DAEMON_OPTIONS declaration, add FEATURE(`no_default_msa') when no MSA is wanted, or replace the default with explicit 127.0.0.1:587 and/or ::1:587 entries for local submission. After rebuilding and restarting, verify that ss -ltnp shows no public :25 listener in either address family.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.