On Sat, 2002-07-27 at 11:15, Brian Ashe wrote: > Robert P. J. Day, > > On Saturday July 27, 2002 05:17, you said something about: > > On Sat, 27 Jul 2002, Anthony E. Greene wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA1 > > > > > > On 26-Jul-2002/05:50 -0400, "Robert P. J. Day" <[EMAIL PROTECTED]> > wrote: > > > >while i'm thinking about it, is there a way to get both > > > >the real and effective user names/UIDs? in case someone > > > >has "su"ed to root, is there a way to see the original > > > >login name? > > > > > > man id > > > > except, under limbo, "id -r" prints: > > > > id: cannot print only names or real IDs in default format (????) > > > > what's up with that? > > It does the same on my 7.2 system. But probably because of this... > > -r, --real print the real ID instead of effective ID, for -ugG > > ...so you have to tell it if this is for a user, group or groups. > > An "id -ur" works fine for me. However, this only fixes the syntax > requirements for id. It seems id is broken. It never seems to identify the > real vs. the effective ids. I don't know if this is in id, su or bash though.
I disagree with your contention that id is broken. You can verify whether or not it is working using ps to show both the real and effective user id of any process. Here is an example: [linush@lh2 linush]$ ps -o f,s,euser,ruser,pid,ppid,c,pri,ni,sz,time,cmd F S EUSER RUSER PID PPID C PRI NI SZ TIME CMD 000 S linush linush 1138 1064 0 25 0 621 00:00:00 bash 000 S linush linush 29194 1138 0 30 0 1354 00:00:01 xpdf 4494.pdf 000 S linush linush 14932 1138 0 30 0 18196 03:43:04 /usr/lib/mozilla/mozilla-bin 040 S linush linush 14937 14932 0 30 0 18196 00:00:27 /usr/lib/mozilla/mozilla-bin 040 S linush linush 14938 14937 0 30 0 18196 00:00:06 /usr/lib/mozilla/mozilla-bin 000 R linush linush 9283 1138 0 24 0 692 00:00:00 ps -o f,s,euser,ruser,pid,ppid,c,pri,ni,sz,time,cmd [linush@lh2 linush]$ su LinusH Password: [LinusH@lh2 linush]$ ps -o f,s,euser,ruser,pid,ppid,c,pri,ni,sz,time,cmd F S EUSER RUSER PID PPID C PRI NI SZ TIME CMD 100 S LinusH LinusH 9289 9286 0 28 0 577 00:00:00 bash 000 R LinusH LinusH 9306 9289 0 20 0 661 00:00:00 ps -o f,s,euser,ruser,pid,ppid,c,pri,ni,sz,time,cmd [LinusH@lh2 linush]$ ps -eo f,s,euser,ruser,pid,ppid,c,pri,ni,sz,time,cmd | grep su 100 S root root 21321 5990 0 30 0 541 00:00:00 su linush 100 S root linush 21734 21324 0 30 0 544 00:00:00 su - 100 S root linush 31798 1094 0 30 0 544 00:00:00 su - 100 S root linush 31696 1155 0 30 0 544 00:00:00 su - 100 S root linush 29709 1197 0 30 0 544 00:00:00 su 100 S root linush 9286 1138 0 30 0 544 00:00:00 su LinusH 000 S LinusH LinusH 9318 9289 0 28 0 370 00:00:00 grep su [LinusH@lh2 linush]$ It should be noted that the su program has the setuid bit set on it and therefore runs as root. When su creates the new shell for you, both the effective and real ids get set. I have shown both the pid and papa pid of each process so you can trace the tree. If you are running from a shell that was created by su and you want to find out who did the su, you have to trace the process tree back to the process that is the parent of su. Linus _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list