Increasing spam filtering with spamassassin
dino.edwards at mydirectmail.net
Sat Aug 27 13:18:01 CEST 2016
> I think this may be your first problem: you are running that command as root,
> aren't you?
> From the configuration you posted earlier, you've amavis setup to run under
> the "amavis" user. See the problem? You are probably training one database
> (at /root/.spamassassin), and then using a different database for the filtering
> (at /var/amavis/var/.spamassasin).
> You should use something like "su amavis -c 'sa-learn --spam /root/reported-
> spam'" instead (the folder and files must be readable by the amavis user
I was under the impression the default path is /var/lib/amavis/.spamasassin. Corrrect me if I'm wrong. Alternatively if you like, so that there is no question, you can set the bayes_path directive in local.cf since you have spent what seems to be a good amount of time training the bayes database located at /root/.spamasassin. That's what I usually do that way there is no question about the location of the bayes db. In your case since you do seem to be training the /root/.spamasassin database, you could set bayes_path in your local.cf as follows:
Note that the directive above is a combination of a directory and a filename prefix. Ensure that whatever user your system uses for amavis has access to that directory (chown amavis:amavis /root/.spamasassin) and ensure it's RWX (chmod 777 /root/.spamasassin) since spamasassin will be executed with that amavis user. Doing it this way you don't have to run sa-learn as a particular user. Running it as root will have the desired effect. Keep in mind you can move the database wherever you like on your system, it doesn't have to be located at /root/.spamasassin directory.
More information about the amavis-users