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 DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk9 min

How to Disable Sendmail Listening on Port 25 on Linux

Step-by-step instructions for disabling Sendmail’s port-25 listener on Oracle Linux 7 and M4-managed Linux systems, including loopback-only port 587 submission and verification.
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 standard SMTP port, then regenerate the configuration, restart Sendmail, and verify both IPv4 and IPv6 listeners. On Oracle Linux 7, set DAEMON=no in /etc/sysconfig/sendmail. On M4-managed systems, edit the .mc source and remove the MTA DAEMON_OPTIONS entry. You can still keep local mail submission by binding an MSA to loopback on port 587.

What disabling port 25 actually changes

Sendmail opens an incoming network socket when it runs in daemon mode. The normal daemon configuration uses TCP port 25, the traditional SMTP port for server-to-server delivery. Removing that socket prevents remote SMTP clients from connecting to the host on port 25; it does not remove Sendmail’s local message-delivery command or necessarily stop queue processing.

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.

Port 25, port 587, and local submission are separate decisions:

  • Port 25 (MTA): used for SMTP traffic between mail servers. Removing its listener stops inbound SMTP on that address and port.
  • Port 587 (MSA): used for message submission by authorized clients. It can remain available, preferably only on loopback when mail is submitted locally.
  • Local Sendmail interface: programs can hand a message to the local Sendmail binary or local queue without an externally reachable SMTP socket.

A firewall rule can block connections, but it does not make Sendmail stop listening. The daemon configuration must be changed when the requirement is that no process listen on port 25.

#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.

Choose the method that matches your Linux packaging

Configuration model Primary change When to use it Persistence consideration
Oracle Linux 7 service configuration Set DAEMON=no in /etc/sysconfig/sendmail. The package supplies this switch and the service reads the file at startup. Keep the setting in the package’s supported file; confirm it after package updates.
M4-managed Sendmail Remove the MTA DAEMON_OPTIONS declaration from the .mc source. The active sendmail.cf is generated from an M4 source file. Edit the source, not only the generated .cf, or regeneration can restore port 25.
M4-managed with local submission Keep an MSA declaration on port 587 bound to 127.0.0.1 and/or ::1; add FEATURE(`no_default_msa') when required. Applications on the same host need SMTP submission but the host must not expose SMTP publicly. Regenerate the configuration from the edited source after every source change.

Do not apply the Oracle-specific variable blindly to another distribution. First identify which package owns Sendmail, where its service reads startup variables, and whether the active configuration is generated from an M4 file.

Before editing: identify the active configuration

Make a backup of the service configuration and the M4 source, if present. Record current listeners so you can distinguish the intended change from an unrelated service:

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.
sudo ss -ltnp

Look for Sendmail’s service unit, startup file, and configuration files under the locations used by your distribution. Common names include /etc/sysconfig/sendmail, /etc/mail/sendmail.mc, and /etc/mail/sendmail.cf, but paths are package-dependent. If sendmail.cf is generated, treat it as an output file and locate the corresponding .mc source before making a permanent change.

Save a copy before editing:

sudo cp -a /etc/sysconfig/sendmail /etc/sysconfig/sendmail.before-port25-change
sudo cp -a /etc/mail/sendmail.mc /etc/mail/sendmail.mc.before-port25-change
sudo cp -a /etc/mail/sendmail.cf /etc/mail/sendmail.cf.before-port25-change

If one of those files does not exist on your system, do not create it merely because it appears in an example; use the file supplied by your package.

Method 1: Oracle Linux 7 DAEMON=no

Oracle Linux 7 documents a service switch in /etc/sysconfig/sendmail. Set the value of DAEMON to no:

sudo vi /etc/sysconfig/sendmail

Set or change the line to:

DAEMON=no

This prevents the Sendmail daemon from starting its inbound SMTP listener when the service starts. Save the file, then restart Sendmail using the service manager configured on the host. On a system using systemd, the operation is typically:

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

Check the service status and inspect the sockets immediately afterward:

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 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.
sudo systemctl status sendmail
sudo ss -ltnp

The Oracle setting is distribution-specific. If a package update replaces the startup file or a local administrator changes the service unit, recheck that DAEMON=no is still being read. If port 25 remains open, inspect the effective service definition and any separately generated Sendmail configuration instead of adding another firewall rule.

Method 2: remove the MTA socket from an M4 configuration

Sendmail’s M4 documentation defines the standard MTA listener with a declaration equivalent to:

DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl

In an M4-managed setup, remove that MTA declaration from the .mc source when no inbound SMTP socket should exist. The documentation’s important distinction is that omitting the MTA declaration leaves no listener on the standard SMTP port.

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

Edit the source file used by your package, for example:

sudo vi /etc/mail/sendmail.mc

Find every DAEMON_OPTIONS line and identify its purpose by the Port, Addr, Family, and Name fields. Delete or comment out only the MTA entry for port 25. Do not remove an MSA entry if local applications still need submission on port 587.

Each DAEMON_OPTIONS occurrence can create an incoming socket. Leaving a second declaration that still uses Port=smtp can therefore keep port 25 open even after one line has been removed.

Prevent an unwanted default MSA

Some M4 configurations generate a default Message Submission Agent entry in addition to the MTA entry. If you want neither a public port-25 socket nor an automatically generated MSA, add:

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')dnl

FEATURE(`no_default_msa') suppresses automatic generation of the default MSA entry. Use it when you intend to define the submission sockets yourself or when no SMTP submission listener should exist at all.

Removing the MTA declaration and disabling the default MSA are separate operations. Removing the MTA stops the standard port-25 listener; the feature controls whether the default MSA is generated. Decide independently whether port 587 is needed.

Keep local submission without exposing SMTP publicly

For a host whose applications need SMTP submission, bind the MSA only to loopback addresses. Debian’s Sendmail guidance illustrates loopback bindings on IPv4 and IPv6. A configuration can contain entries of this form, adjusted to the syntax and naming conventions of your package:

FEATURE(`no_default_msa')dnl
DAEMON_OPTIONS(`Port=587, Addr=127.0.0.1, Name=MSA')dnl
DAEMON_OPTIONS(`Port=587, Addr=::1, Family=inet6, Name=MSA')dnl

The first line prevents an automatic MSA from being added in addition to your explicit entries. The IPv4 entry accepts submissions only through 127.0.0.1; the IPv6 entry accepts them only through ::1. Neither address is reachable from another machine through a normal network interface.

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.

If the application uses the local Sendmail command rather than SMTP, no port-587 listener is required. Conversely, if an application is configured to connect to localhost:587, retain the loopback MSA and make sure the application’s address family matches the socket you created.

Do not bind the MSA to 0.0.0.0 or :: when the goal is local-only submission. Those wildcard addresses expose the service on every matching interface and can create a new externally reachable submission endpoint.

Regenerate and install the active configuration

Editing a .mc file does not change the running daemon by itself. Build a new sendmail.cf using the regeneration mechanism supplied by your distribution, install it in the location used by the Sendmail service, and then restart Sendmail.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • 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

A commonly used M4 workflow is conceptually:

sudo m4 /etc/mail/sendmail.mc > /tmp/sendmail.cf.new
sudo install -o root -g root -m 0644 /tmp/sendmail.cf.new /etc/mail/sendmail.cf
sudo systemctl restart sendmail

The exact source path, ownership, permissions, and helper command vary by package. Some distributions provide a make target or a configuration script that performs these steps. Prefer that package-supported method when available. The essential order is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Edit the authoritative .mc source.
  2. Generate a new sendmail.cf.
  3. Install the generated file where the service reads it.
  4. Restart Sendmail.
  5. Inspect listeners and logs for errors.

If generation fails, do not restart with a partially written file. Restore the previous working configuration, correct the M4 syntax, regenerate to a temporary file, and compare the result before installing it.

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

Verify that port 25 is closed on both IPv4 and IPv6

Use ss after the restart:

sudo ss -ltnp | grep -E '(:25b|:smtpb)'

No output means this command found no matching listening TCP socket. To inspect all Sendmail sockets without filtering:

sudo ss -ltnp

Check the address as well as the port. A successful port-25 shutdown must not show public bindings such as:

0.0.0.0:25
[::]:25

When local submission is retained, the expected remaining MSA sockets are limited to the addresses you configured, for example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
127.0.0.1:587
[::1]:587

An entry on 0.0.0.0:587, a server’s real IPv4 address, or [::]:587 indicates that the MSA is not loopback-only. An entry on [::]:25 matters even when no IPv4 port-25 socket appears; IPv6 can provide a separate public path.

On systems without ss, use the platform’s socket-listing equivalent, such as netstat -ltnp where that utility is installed. The verification requirement is the same: inspect listening TCP sockets for both address families and identify the owning process.

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.

When port 25 still appears

A second daemon declaration remains

Search the active M4 source and generated configuration for additional DAEMON_OPTIONS entries. Sendmail creates an incoming socket for each daemon-port declaration, so one leftover MTA or SMTP declaration can recreate port 25.

The generated file was not rebuilt

If the source is correct but the running service still listens, compare the modification time of sendmail.cf with the time of regeneration. Rebuild and install the file through the package’s supported method, then restart the service.

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

The wrong file was edited

Multiple Sendmail installations or custom service units can use different configuration paths. Inspect the service definition and the process command line to determine which sendmail.cf and startup variables are actually active.

IPv6 was overlooked

A check that looks only for an IPv4 address can miss [::]:25. Always inspect both families, or review the complete unfiltered ss -ltnp output.

Another process owns port 25

The socket listing identifies the owning process. If it is not Sendmail, changing Sendmail’s M4 source cannot close that listener; investigate the other service separately.

The service failed after the change

Check the service status and system logs for M4 syntax errors, invalid address-family options, or permission problems. Restore the saved configuration if necessary, then regenerate a corrected file before attempting another restart.

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

Operational effects and trade-offs

  • Inbound mail to this host: remote SMTP servers cannot deliver directly over port 25 after the listener is removed. If the host is intended to receive mail, provide another designated mail exchanger or forwarding arrangement before making the change.
  • Local mail generation: applications that invoke the local Sendmail interface can continue to hand messages to the local service, subject to the rest of the configuration.
  • Queue processing: inbound daemon sockets and queue work are separate Sendmail functions. Disabling the port-25 listener is not the same as disabling all message delivery or queue runs.
  • Authenticated submission: retaining port 587 on loopback supports local SMTP clients, but it does not create a public submission service. A client on another host will not reach a loopback-only binding.
  • Configuration regeneration: direct edits to a generated .cf file are fragile. Future M4 regeneration or package maintenance can overwrite them, so keep the change in the authoritative source or supported service configuration.

Port-25 shutdown checklist

  1. Determine whether the host uses Oracle Linux 7’s /etc/sysconfig/sendmail switch, an M4 source file, or another package-specific mechanism.
  2. Back up the active startup and configuration files.
  3. Set DAEMON=no on Oracle Linux 7, or remove the MTA DAEMON_OPTIONS entry from the M4 source.
  4. Add FEATURE(`no_default_msa') if an automatically generated MSA must also be suppressed.
  5. If local SMTP submission is required, define port 587 on 127.0.0.1 and/or ::1 only.
  6. Regenerate and install sendmail.cf using the distribution’s supported procedure.
  7. Restart Sendmail and confirm the service is healthy.
  8. Use ss -ltnp to verify that neither public IPv4 nor public IPv6 has a TCP port-25 listener.
  9. Confirm that any remaining port-587 sockets are exactly the loopback addresses intended for local clients.
  10. Recheck the configuration after package upgrades or any process that regenerates Sendmail’s .cf file.

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 from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.