[lug] logging a script when executed using sudo

charles at lunarmedia.net charles at lunarmedia.net
Thu Sep 20 07:48:22 MDT 2001


i am writing a script and i would like to include some logging capability.
the script however, will more than likely be ran via sudo.

according to the sudo man page:

       The real and effective uid and gid are set to match
       those of the target user as specified in the passwd file

so, i assume that if i were to attempt to put the username of the
individual running the script into the log file, it will turn up as 'root'
rather than as the actual non-privelaged user.

is this a general practice when logging items executed as sudo? are
sysadmins correlating one log file against the sudo log entries and
matching timestamps to figure out who did what?

regards, -c




More information about the LUG mailing list