Sunday, April 3, 2011

How do I sudo environment?

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

From stackoverflow
  • sudo -u <username> <command> ...
    
    kman99 : Tried that uses the prefence files of the users calling sudo not the user in sudo
  • 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.

0 comments:

Post a Comment