Re^2: getuid() and geteuid() on Ultrix 2.0

Steve Dempsey dempsey at handel.colostate.edu.
Sun Oct 30 16:17:09 AEST 1988


In article <579 at jim.odr.oz> brw at jim.odr.oz (Brian Wallis) writes:
>
>On Ultrix 2.0 on our MicroVax II, the system calls getuid() and
>geteuid() both seem to return the same uid no matter what you have
>su'd to. ie. If I su to 'local' and run a simple program that prints
>both uid's as returned by getuid and geteuid I get the uid of local
>from both whereas I thought I should get the uid of me ('brw') from
>getuid(). Here is tmp.c and the results...

  [demonstration deleted]

>This is very annoying! Is this an Ultrix only bug (I have nothing else
>to try it on) or am I confused and this is correct behaviour?
>
>Brian Wallis (brw at jim.odr.oz)		    O'Dowd Research P/L.

--------- AND ---------

In article <355 at auspex.UUCP> guy at auspex.UUCP (Guy Harris) writes:
>
>This is correct behavior.  "su" changes both the real and effective user
>ID on every version of UNIX I've ever seen.  *Not* having that behavior
>would be *extremely* annoying....

Correct; running su changes both.  The case when getuid() and geteuid()
return different values is a setuid executable.  Try changing the ownership
on that little program and changing mode to 4755.  When it is run by a user
other than the owner, the uid will be the user's, but the euid will be that 
of the file's owner.  Thus the user who executes the program will gain such
permissions as would normally be granted to the file's owner during the
execution of that code.

 /\             \Steve Dempsey,  Center For   \steved at longs.LANCE.ColoState.Edu
 \/ _|/ _       _\Computer Assisted Engineering\dempsey at handel.CS.ColoState.Edu
 /\  | (_) | |_(_)\Colorado State University    \...!ncar!handel!dempsey
/_/_/(_/\_/ V   \_ \Fort Collins, CO  80523      \(303)-491-0630



More information about the Comp.unix.wizards mailing list