11

My VPS image (Debian 6) comes pre-installed with sendmail as the MTA. I will use this server as a web server, and maybe other usages but not as a mail server. I want to remove as many unneeded services as possible to save resources. Can the MTA be safely removed? What are the consequences?

3 Answers 3

15

One consequence of removing the MTA is that mail generated by the system itself (usually sent to root), for example by Cron, Logwatch, rkhunter and others cannot be be delivered.

So yes, an MTA is an integral part of any Unix-like system and I doubt Debian will let you uninstall the MTA without complaining and suggesting an alternative. But it's not a big deal. By default in Debian even sendmail will only listen on 127.0.0.1 and relay mail only locally, so there is no real security risk here.

1
  • A small addition to this answer though. Some unexperienced administrators keep MTA as it is, which may lead to disappearing disk space. Our 3rd party hoster did not even think about it until we ran out of space in /var. Default partition size was 4G, 1.5G was consumed by logs and the rest eaten up by /var/spool/mail. Which makes it not a security risk, but rather general administration issue. Mar 23, 2015 at 3:27
8

The MTA is used to handle all kinds of messaging, not just email to user mailboxes. On my CentOS system, it is using a whopping 4 MB of RAM. That's less than one PHP thread. Don't jeopardize the stability and operation of your server for a pittance of extra capacity. Buy more capacity instead.

2

Instead of removing sendmail (or any other MTA) for reasons explained in other answers, you can configure it to send all system generated email to a mail account of your choice, so as to review it at a later time.

Since this is a Debian system, backup your /etc/mail/sendmail.mc and then replace it with the contents below:

VERSIONID(`2006/08/23/00')dnl
OSTYPE(`debian')dnl
DOMAIN(`debian-mta')dnl

dnl # define(`SMART_HOST', `[outgoing.example.com]')dnl
define(`confCW_FILE', `-o /etc/mail/local-host-names')dnl
FEATURE(`use_cw_file')dnl

FEATURE(`no_default_msa')dnl
DAEMON_OPTIONS(`Name=MTA-v4, Addr=127.0.0.1, Port=smtp')dnl
DAEMON_OPTIONS(`Name=MSP-v4, Addr=127.0.0.1, Port=submission')dnl

MAILER(`local')dnl
MAILER(`smtp')dnl

LOCAL_RULE_0
# LHS is separated from RHS with tabs, not whitespaces
R$- <@ $=w . >          john.doe < @ example.com. >

Two notes:

  1. You may not need the SMART_HOST line. That is why it is already commented out.
  2. In the last line the left hand side is separated from the right hand side with tabs, not spaces. So do not copy-paste, type by hand.

After you are done, run sendmailconfig and check whether this solution works for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .