0

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

kman99
  • 6,565
  • 4
  • 21
  • 20

2 Answers2

1
sudo -u <username> <command> ...
eduffy
  • 35,646
  • 11
  • 90
  • 90
0
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
  • 30,601
  • 18
  • 82
  • 102