Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have mail gateway servers configured to use MailScanner + Postfix + SpamAssassin as described here, along with MailWatch as a web front end.

When sa-learn is run from MailWatch (it's run as the postfix user), it throws this error:

SA Learn: config: path "/root/.spamassassin" is inaccessible: Permission denied, Learned tokens from 0 message(s) (1 message(s) examined)

Running "sudo -u postfix spamassassin --lint -D" gives this bit of info:

dbg: config: read file /etc/mail/spamassassin/mailscanner.cf
warn: config: path "/root/.spamassassin" is inaccessible: Permission denied
dbg: config: mkdir /root/.spamassassin failed: mkdir /root/.spamassassin: Permission denied at /usr/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin.pm line 1577
dbg: config: Permission denied
dbg: config: using "/etc/MailScanner/spam.assassin.prefs.conf" for user prefs file

The bayes tokens are learned correctly, however this error is a minor annoyance and I'd like to fix it... Either by forcing SpamAssassin to not check the /root/.spamassassin/ directory for the config & prefs, or to fix MailWatch so it calls sa-learn correctly & doesn't throw this error.

share|improve this question

4 Answers 4

up vote 1 down vote accepted

The real fix is to disable "per-user" config in spamassassin and globally set the Baysean DB, but a quick patch would be to add the "-H" option to sudo to use postfix's home directory where it should have permission to write as postfix.

share|improve this answer
    
This sounds like it might be along the correct lines, but I'm still looking for specific documentation on how to accomplish this... once I do & if it turns out to be correct, I'll post it here and check this as answered unless someone beats me to the punch. –  gharper Jul 13 '09 at 23:07
    
Of course the other option is to symlink /root/.spamassassin to ~postfix/.spamassassin I've done this on one machine and it does work as long as the permissions are ok. –  LapTop006 Jul 14 '09 at 14:42

This could be a workaround:

# chmod o+x /root
# mv -f /root/.spamassassin /root/.spamassassin.err
# ln -s /var/spool/MailScanner/spamassassin /root/.spamassassin
# mkdir -p /var/spool/MailScanner/spamassassin
# chown postfix.apache /var/spool/MailScanner/spamassassin
# chmod 770 /var/spool/MailScanner/spamassassin
share|improve this answer
1  
This was my original thought for a workaround, but making /root traversable by anyone doesn't really give me the warm fuzzies... While I don't think it's necessarily a security risk, I'd rather avoid it if at all possible. –  gharper Jul 29 '09 at 15:07

Shouldn't you use the spamassassin daemon spamd instead? Then you'd use the spamc command instead of spamassassin. Basically, run spamd from its startup script, and use spamc from your mailscanner.

share|improve this answer
    
MailScanner doesn't actually use spamd, spamc, or the spamassassin script directly, it calls the installed perl modules. –  gharper Jun 25 '09 at 20:11
1  
I see. Then you should tell sa-learn to use some other place ( postfix-writable) to store its data with the --dbpath option. –  wazoox Jun 26 '09 at 9:26
    
The bayes database is already writable by postfix, which is why tokens are being learned correctly - what I'm trying to fix is sa-learn checking the root directory for config files first & throwing an error before correctly using the global config file in /etc/MailScanner/ and moving on. –  gharper Jun 26 '09 at 15:19

Did you try adding --dbpath parameter, like this ?

sa-learn --dbpath /var/lib/amavis/.spamassassin/ ....
share|improve this answer
    
Yup, and it still throws the "config: path "/root/.spamassassin" is inaccessible: Permission denied" error –  gharper Jul 13 '09 at 22:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.