Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Really real User Ids on Solaris

by Nitrox (Chaplain)
on Jul 22, 2002 at 15:17 UTC ( [id://184093]=CUFP: print w/replies, xml ) Need Help??

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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (1)
As of 2024-04-25 00:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found