loginid vs. uid.

karish at mindcrf.UUCP karish at mindcrf.UUCP
Tue Jul 17 06:05:45 AEST 1990


In article <234 at twg.wimsey.bc.ca> bill at twg.wimsey.bc.ca (Bill Irwin) writes:
>In <11399 at hydra.gatech.EDU> gt0178a at prism.gatech.EDU (BURNS,JIM) writes:
>
>$in article <232 at twg.wimsey.bc.ca>, bill at twg.wimsey.bc.ca (Bill Irwin) says:
>$> How do you change your logname to "wimp" when you "su - wimp"?  I have an
>$> email  application  that  uses the logname to determine  which  directory
>$> structure  to deal with in mail sessions, which makes it impossible to su
>$> to another user and read their mail.

    Some mail readers have options designed to make this easy (`-u',
    under Berkeley mail).  Others show more respect for their users'
    privacy.  As super-user you should be able to scan the spool
    directly no matter what your logname is.

>[....]
>$                                 And of course, $LOGNAME will depend on
>$whether you used the '-' flag to su or not.
>
>Not  on my system it doesn't.  I have SCO XENIX V/386 2.3.2 and I get  my
>original  logname whether I use "-" in the su, or not.  From replies I've
>been getting, I'm getting the impression that using the "-" should change
>the output of "logname" to that of the user changed to.

    The SVID says "The command logname returns the user's login name".

    POSIX.1 says that $LOGNAME, if it exists, should contain "The name
    of the user's login account...".  There's no mention of when
    $LOGNAME should be changed or even of whether it should be
    changeable by the user.

    The SVID description of su says "If the first argument to su is a -,
    the environment will be changed to what would be expected if the user
    actually logged in as the specified user".  The `environment' is,
    presumably, the list of tag=value pairs stored in the `environ'
    array.  This does not necessarily reflect what's returned by the
    logname utility or the getlogin() function.

    The point of having separate logname() and getuid() functions is
    to maintain the login ID and the real UID as separate concepts.
-- 

	Chuck Karish		karish at mindcraft.com
	Mindcraft, Inc.		(415) 323-9000		



More information about the Comp.unix.questions mailing list