Should "su" change the USER environment variable?

Guy Harris guy at rlgvax.UUCP
Thu Nov 3 02:42:24 AEST 1983


In USG UNIX, "login" is no longer a real command (it lives in /etc) and the
shell does not recognize it as a special command.  This may have been done
for the reasons mentioned; i.e., it monkeys with the who table entry.  The
"su" command in USG UNIX has an option to act like what you usually want
when you do a "login" command; i.e., it forks off a new shell and runs it
with argv[0] == "-su", so it thinks it's a login shell and runs /etc/profile
and the user's .profile.  It does not, however, change the LOGNAME environment
variable (serves the same function as USER), which makes it a pain to use
"su" to read the mail sent to pseudo-users like "adm" without having to log
in as "adm" (or worse, pseudo-users like "uucp" who don't have a normal login
shell).  Of course, since USG "mail" has a forwarding facility you're probably
supposed to forward their mail to a real person and not use "su" for this.

	Guy Harris
	{seismo,inhp4,allegra}!rlgvax!guy



More information about the Comp.unix.wizards mailing list