Problem with getuid() -- same as geteuid()?!

Steven Winikoff smw at maxwell.Concordia.CA
Sat Feb 3 09:58:35 AEST 1990


In article <?_3}%- at rpi.edu> tale at cs.rpi.edu (David C Lawrence) writes:

>@opinionated sidebar
>I personally loathe getlogin() and programmes that are concerned with
>what userid I might have started out as on some pre-su level, so I
>won't describe how to do it.  One thing you might want to reconsider
>is why you are concerned with the userid of the login.  When I su to
>someone else I want my userid to be that one, not the one that I was.

My problem is that there are several people at our site who are legitimately
able to su root, working on different projects at the same time (perhaps 
that's a bad idea, but it's not under my control).  In any case, the idea
is to find some way to identify our printed output, from within a local
customized print program.  Several hundred (ok, I'm exaggerating!) listings
all marked "root" are, IMHO, less useful than the same listings broken down
by our real user name.

Perhaps I'm going about this by trying to solve the wrong problem, but that's
what I'm looking for.  Thoughts?  Comments?  Ideas?  All would be appreciated.

>If there was a bug in it then things would have been upchucking all
>over the place and people would be up in arms about it.  

That does make sense, I suppose :-)

>geteuid() is
>used to get the userid of a setuid executable.  getuid() is meant to
>return the userid that invoked the programme.  For non-setuid
>executables they will always return the same number.

Thanks for the clarification!

------------------------------------------------------------------------
Steven Winikoff                                 smw at maxwell.concordia.ca
Software Analyst
Dept. of Computing services
Concordia University                            voice: (514) 848-7619
Montreal, Quebec, Canada                               (10:00-18:00 EST)  



More information about the Comp.unix.questions mailing list