Change in v5.x LOGNAME shell variable and su

From: Davis, Alan <Davis_at_tessco.com>
Date: Fri, 30 Mar 2001 09:49:59 -0500

Some of my scripts written under v4.x use both LOGNAME and USER variables.
Under v5.x some of the scripts are failing due to an apparent difference in
the way that su modifies the environment. Has anyone else run into this?

Under v5.x the LOGNAME variable isn't set to the effective username after an
su, it stays the original username. Here's an example :

v4.0e :
$ env | grep LOGNAME
LOGNAME=davis
$ env | grep USER
USER=davis
$ su - sysdavis
Password:
# env | grep LOGNAME
LOGNAME=sysdavis
# env | grep USER
USER=sysdavis

v5.1 :
$ env | grep LOGNAME
LOGNAME=davis
$ env | grep USER
USER=davis
$ su - sysdavis
Password:
# env | grep LOGNAME
LOGNAME=davis
# env | grep USER
USER=sysdavis

The manpage for su has been modified, but it doesn't accurately describe the
effect of su on the LOGNAME variable.

Alan Davis
davis_at_tessco.com
Received on Fri Mar 30 2001 - 14:51:10 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:42 NZDT