# Share sa-learn trainign with all users

## fvant

I always thought that if i run sa-learn as root and use folders from several users as training input, all users got to benefit from the learning SA is doing. After reading some posts and sites i am not so sure anymore.

if i have multiple users in a domain, how should i config SA and properly sa-learn SA so that all users use the same ruleset/trained behaviour ?

----------

## KRF

As root, run: 

```
sa-learn --spam --dir ~user1/somemaildir

sa-learn --spam --dir ~user2/somemaildir
```

Then symlink the /root/.spamassassin to ~user1/.spamassassin and ~user2/.spamassassin

They should have the same trained SA now (I think   :Wink: ).

Tell me if I'm wrong.

----------

## fvant

The answer is in this setting in /etc/spamassassin/local.cf

 bayes_path /path/filename     (default: ~/.spamassassin/bayes)

           This is the directory and filename for Bayes databases.  Several databases will be created, with this as the base directory and filename, with

           "_toks", "_seen", etc. appended to the base.  The default setting results in files called "~/.spamassassin/bayes_seen", "~/.spamassas-

           sin/bayes_toks", etc.

           By default, each user has their own in their "~/.spamassassin" directory with mode 0700/0600.  For system-wide SpamAssassin use, you may want

           to reduce disk space usage by sharing this across all users.  However, Bayes appears to be more effective with individual user databases.

----------

## trossachs

Hasn't the:

```
sa-learn --dir
```

... switch been depreciated in the 3.1.x series of Spamassassin? Since I have upgraded from 3.0.4 to 3.1.6, SA no longer recognises the --dir command. Do I get around this by going into the directory I want sa-learn to scan and then printing:

```
sa-learn --spam
```

from within that said directory?

----------

## KRF

You're right. I just noticed that --dir is deprecated (my whole sa-crons did not work all the time   :Embarassed: ). So i had to replace --dir with --mbox. 

For more info use man sa-learn. It's quite helpful.

----------

## trossachs

I only noticed because since I have switched the 3.1.x series, I have started to get spam through everyday. I checked my cron jobs and they were all running so I tried a manual run on sa-learn and noticed the --dir change.

Can I use this --mbox switch with maildirs?   :Confused: 

----------

## KRF

Depends on your email-client I think. With kmail e.g. you can easily use 

```
sa-learn --spam .kde/share/apps/kmail/mail/inbox/cur
```

Ask google.   :Cool: 

----------

## trossachs

Sorted! I'd forgotten about the full maildir path to .../cur   :Wink: 

----------

## fvant

 *KRF wrote:*   

> Depends on your email-client I think. With kmail e.g. you can easily use 
> 
> ```
> sa-learn --spam .kde/share/apps/kmail/mail/inbox/cur
> ```
> ...

 

sa-learn has nothing to do with your mailclient  but the example you give is correct.

----------

## KRF

But it depends on how the email-client saves the emails. And the question was whether he needs the --mbox switch or not. And in case of kmail he doesn't.

----------

