Help with Spam Assassin

Posted on 2009-02-23
Last Modified: 2013-12-09
I need help with Spam Assassin.

1. What version of Spam Assassin do I have?   I was told that I need to do this through SSH.   I am able to open putty and my spam assassin is installed in this directory:    /.spamassassin/

Please tell me what to type in my putty command line to determine the current version of spam assassin.   If you know of an easier way rather than SSH, please tell me that instead.  :-)

2. How do I update spam assassin?   I read on the apache site that I need to run sa-update, but I need the exact syntax.   My spam assassin folder is called /.spamassassin/

I can get putty to open for root CLI commands.  Please tell me what to type to update sa-update.

3. I also know how to create a cron job.  I think that if sa-update will work as a command line, that I could also enter this as a cron job to run nightly.  Please confirm if I can do this with the same syntax.

4. I read that I can add specific emails to a spam assassin white list via command line.   Can you tell me the syntax to use to add my sent emails to the whitelist?

5. Next Id like to set up the baysean filter.  If you can answer the above questions, you probably know how to do this as well.   I can read the apache instructions, but am wondering if there is a way to do this other than through command line.

Thank you for your help!
Question by:Shawn-in-VA
    LVL 23

    Expert Comment

    1. spamassassin --version
    2. If you are using linux, then what distribution? If you are using some other *nix system - then what is it?
    3. Yes, you can :) Add below line into your crontab (to run sa-update daily at 1am):
    0 1 * * * /path/to/your/sa-update && /etc/init.d/spamassassin reload
    You may need to change this /etc/init.d/ path to one that suits your environment
    4. Add to your configuration file (for user it is by default ~/.spamassassin/user_prefs) below line:
    5. I don't know other possibilities that command line (I don't say, that there is no such possibility, but I just use commandline). It should be enabled by default.

    Author Comment

    oklit - Thanks for your reply.  

    1. your answer worked perfectly.  I have spam assassin 3.2.4 and perl 5.8.8

    2. How do I update spam assassin?   I'm running linux, apache 2.2.11.  I went to the spamassassin faq area and found this sa-update syntax:
    sa-update && service spamassassin restart

    This appears to work, but can you tell me how to confirm that it actually is working?   When I enter that into my putty command line, the system accepts the command and returns a new command line with no message about what it did.  

    3. for an update cron job, you suggested this:
    0 1 * * * /path/to/your/sa-update && /etc/init.d/spamassassin reload

    Regarding #3, i have a few questions:
    - can I test this syntax in putty or is this specific to a cron job?

    - what is the path to sa-update?  I could not find it?   Also I could not find Init.d/spamassassin.

    Please try and reply with the exact syntax to use (or ask me for more path info and I'll look to confirm the exact paths).  

    4. you answered great.  thanks.

    5. I'll use the command line if i have to, but can you tell me how to better train it when it does not identify spam correctly.  

    Thanks for your help!
    LVL 23

    Accepted Solution

    2. I don't use sa-update (probably I should, but didn't have to for now - spam is recognized correctly, and I use almost the same configuration, since installing it - it is something about 4 year now).
    Moreover - I misunderstood your question. I thought you meant to upgrade spamassassin, not update - that's why I asked for distribution :)
    In most cases it should be enough to run just "sa-update" command without any parameters (but you need to run this as root).

    3. In crontab, you should provide full paths to binaries. TO check where is your sa-update located, login, and run: "which sa-update". You will probably get /usr/bin/sa-update or similar. Use full path (/usr/bin/sa-update, or whatever output you get) in crontab.
    If you are running spamassassin as daemon, you should restart it after updating. /etc/init.d/spamassassin is script to start/stop/restart/reload spamassassin's daemon. Do you have /etc/init.d/ directory? Do you have spamassassin file inside this directory? If no - what distribution you have? Maybe you have /etc/rc.d/ or similar in which this script is located. But - if you don't run spamassassin as deamon (spamd) you probably don't need to reload/restart it, so sa-update without /../../spamassassin reload should be enough.
    Finally - of course you can test it in commandline. Crontab entries are in fact commandline command.
    command1 && command2 means: run command2 only if command1 finished successfully.
    If "service spamassassin restart" works for you, then use it instead of directly calling /etc/init.d/spamassassin.
    So, crontab entry should be:
    0 1 * * * /usr/bin/sa-update && /usr/bin/service spamassassin reload
    (in case you have this files in other places, change paths accordingly - you may check them typing: "which sa-update service").

    5. Use "sa-learn". You can point sa-learn to mailbox with spam (sa-learn --spam /path/to/mailbox/with/spam). You need also to learn spamassassin what is not spam (what is ham): sa-learn --ham /path/to/mailbox/with/ham
    Refer to man sa-learn (or sa-learn --help) for more options.
    More than this - you may also create your own rules. To add some rule for specific user, edit his/her ~/.spamassassin/user_prefs file. If you want to add rules for all users, edit your file. You can find example of creating your own rules in spamassassin here: http:/Q_24144658.html

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
    The purpose of this article is to demonstrate how we can use conditional statements using Python.
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now