Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Really real User Ids on Solaris

by Nitrox (Chaplain)
on Jul 22, 2002 at 15:17 UTC ( #184093=snippet: print w/replies, xml ) Need Help??
Description: I'm part of a large Web Engineering team where we all share a privileged account on our app and web servers. The problem that has plagued me for sometime is the ability to effectively log activities due to Perl reporting the Effective and Real User/Group ID's as those of the privileged account that you are currently 'su'd to. My solution is below, and now allows me to log activity by the actual user.
print my ($real_user) = `who am i` =~ /^(\w+)/;
Replies are listed 'Best First'.
Re: Really real User Ids on Solaris
by rob_au (Abbot) on Jul 22, 2002 at 21:06 UTC
    Not surprisingly merlyn has a similar snippet of code here that performs the same task without the system call - It may be useful to you as 'yet another way to do it' :-)


      Nice! :) But doing the system call in mine will always return the username of the "true" user. -Nitrox
Re: Really real User Ids on Solaris
by cybear (Monk) on Jul 24, 2002 at 15:27 UTC
    You could have put that thing in the Obfuscation section!
    Quite slick though.
Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: snippet [id://184093]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2023-09-21 21:17 GMT
Find Nodes?
    Voting Booth?

    No recent polls found