views:

284

answers:

2

I am using spamassassin in a php script, but when I train spamassassin as my user the php script's exec command to call spamassassin get the untrained version because of the user specific nature of sa-learn. So I need to sudo to my user in the exec command and get the environment of my user along with the premissions

+1  A: 
sudo -u <username> <command> ...
eduffy
Tried that uses the prefence files of the users calling sudo not the user in sudo
kman99
A: 
sudo -H -u <username> <command>

The -H flag sets the $HOME environment variable. Without setting this flag, SpamAssassin is probably looking in the old user's homedir for settings.

pix0r