Mail filtering with spam-assassin

In this recipe, we will learn how to install and set up a well-known e-mail filtering program, spam-assassin.

Getting ready

You will need access to a root account or an account with sudo privileges.

You need to have Postfix installed and working.

How to do it…

Follow these steps to filter mail with spam-assassin:

  1. Install spam-assassin with the following command:
    $ sudo apt-get update
    $ sudo apt-get install spamassassin spamc
    
  2. Create a user account and group for spam-assassin:
    $ sudo groupadd spamd
    $ sudo useradd -g spamd -s /usr/bin/nologin \
    -d /var/log/spamassassin -m spamd
    
  3. Change the default settings for the spam daemon. Open /etc/default/spamassassin and update the following lines:
    ENABLED=1 SAHOME="/var/log/spamassassin/" ...

Get Ubuntu Server Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.