Apply Global Spam Filters via Terminal

This guide shows you how to quickly apply a centralized spam filter list to any cPanel account using a single command. Perfect for blocking waves of spam across multiple users without manually editing filters.

Step-by-Step Instructions

Step 1: Log in as Root via SSH

SSH terminal login

Connect to your server using SSH and log in as root.
You can also login to WHM as the root user and utilize the server built in Terminal.

ssh root@your-server-ip

Step 2: Switch to the Target cPanel User

Switch user in terminal

Replace USER with the cPanel account username.

su USER

Step 3: Navigate to the User Home Directory

Navigate to home directory

Ensure you're in the correct home directory before running the script.

cd /home/USER

Step 4: Run the Spam Sync Script

Run curl command

This command downloads and executes the spam filter script. It automatically pulls the latest global spam list and applies it to the account.

curl -s https://fixyourwordpress.com/spams/spam_sync.sh | bash

Step 5: Activate the Filters

cPanel filters page

Since cache rebuild requires root-level cPanel binaries, you must trigger it manually:

  • Log into cPanel for the user
  • Go to Email → Global Email Filters
  • Click Save (no changes needed)

This activates the new filters immediately.

Step 6: Verify the Filter

verify filter

You should now see a filter named:

AUTO_SPAM_SYNC

This filter contains your global spam blocklist and will automatically discard matching emails.

What This Script Does

Important Notes