Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Logging script usage when executed via sudo on *nixby c (Hermit) |
on Sep 20, 2001 at 17:54 UTC ( [id://113587]=perlquestion: print w/replies, xml ) | Need Help?? |
c has asked for the wisdom of the Perl Monks concerning the following question:
a unix question wrapped in perl paper. i'm adding logging capability to a script i've recently written. i would like to include the name of the non-privelaged user executing the script in the log file. however, this script will more than likely always need to be ran using the sudo command. sudo forces the uid/gid of the current user to that of root, and therefore the log entry contains "root" rather than the non-privelaged user's name. has anyone ran into this issue before, and if so, how did they handle it? i've been trying to come up with a way that perl could pull the name of the user originally executing the script, but i am at a loss. humbly -c
Back to
Seekers of Perl Wisdom
|
|