Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!mindcrf.UUCP!karish From: karish@mindcrf.UUCP Newsgroups: comp.unix.questions Subject: Re: loginid vs. uid. Summary: $LOGNAME Message-ID: <9007162005.AA11293@mindcrf.mindcraft.com> Date: 16 Jul 90 20:05:45 GMT References: <232@twg.wimsey.bc.ca> <11399@hydra.gatech.EDU> <234@twg.wimsey.bc.ca> Sender: daemon@ucbvax.BERKELEY.EDU Organization: Mindcraft, Inc. Lines: 43 In article <234@twg.wimsey.bc.ca> bill@twg.wimsey.bc.ca (Bill Irwin) writes: >In <11399@hydra.gatech.EDU> gt0178a@prism.gatech.EDU (BURNS,JIM) writes: > >$in article <232@twg.wimsey.bc.ca>, bill@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@mindcraft.com Mindcraft, Inc. (415) 323-9000