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.

But to answer your original question...

You could use the "logname" command to do a comparison like so...

#!/bin/bash
# I did not test this (or even try) for portability.

ID=`id -un`
LOGINN=`logname`

if [ "$ID" == "$LOGINN" ] ; then
        echo "Usernames Match : OK"
fi

exit 0

-- 
Brian Ashe                                                     CTO
Dee-Web Software Services, LLC.                  [EMAIL PROTECTED]



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to