I just got markasjunk2 and dspam working together on my FreeBSD server. As a reference for others doing the same, here are the changes in permissions needed so that the webserver running RC can access dspam, where "www" is the user ID of the webserver:
Make dspam executable by the webserver:
# chmod go+x /usr/bin/dspam
Make the conf file readable:
# chmod go+r /usr/local/etc/dspam.conf
Add the webserver to the 'mail" group so it can access /var/db/dspam/..
# pw usermod www -G mail
You also need to add "Trust www" to dspam.conf
Reference: Integrating DSPAM with Roundcube's markasjunk2 (http://jve.linuxwall.info/blog/index.php?post/2011/02/08/Integrating-DSPAM-with-Roundcube-s-markasjunk2)
FWIW, these are the two commands I am using in ../roundcube/plugins/markasjunk2/config.inc.php
$rcmail_config['markasjunk2_spam_cmd'] = "/usr/local/bin/dspam --user %i --class=spam --source=error --signature=%xds";
$rcmail_config['markasjunk2_ham_cmd'] = "/usr/local/bin/dspam --user %i --class=ham --source=error --signature=%xds";
I have found that the "%xds" parameter doesn't seem to work on my installation and using it confuses dspam.
AFAICT, this parameter is superfluous anyway, since dspam writes the signature to the message body or header, and when retraining a message it finds this information and uses it. It isn't necessary to pass the signature on the command line.
Hence, I am now using this:
$rcmail_config['markasjunk2_spam_cmd'] = "/usr/local/bin/dspam --user %i --class=spam --source=error";
$rcmail_config['markasjunk2_ham_cmd'] = "/usr/local/bin/dspam --user %i --class=ham --source=error ";