mvr707 has asked for the wisdom of the Perl Monks concerning the following question:

I need to run a system command as a specific user - yes, I have the credentials. Looking for something like... system(<command>, <user>, <password>) Intent is to run the <command> as <user> Suggestions?

Replies are listed 'Best First'.
Re: Run command as a user
by Anonymous Monk on Mar 24, 2011 at 03:59 UTC
Re: Run command as a user
by jaimon (Sexton) on Mar 24, 2011 at 07:49 UTC
    It might not wise to keep the plaintext passwords in the script. You could provide sudo privilage to your user to run the required command as the needed user without needing password, and call system(sudo -u user ...) on *nix env.
Re: Run command as a user
by GrandFather (Saint) on Mar 24, 2011 at 03:41 UTC

    What OS?

    True laziness is hard work