Bug#3008: Telnetd sets wrong USER (funny side effects)
On Fri, 17 May 1996, Ian Jackson wrote:
> Peter Tobias writes ("Bug#3008: Telnetd sets wrong USER (funny side effects)"):
> > IMHO the only solution to the problem would be to add a
> > setenv("USER", pwd->pw_name, 1);
> > to the login program. The source already sets USER like this on
> > non linux platforms.
> Surely if login doesn't set USER it should at least squash it so that
> it doesn't have a bogus value ?
I don't mind changing login to set or clear the USER variable, but any
program that requires it is buggy. Consulting W.R. Stevens, I find
that USER is required by neither POSIX.1 nor XPG3. LOGNAME is, and
login dutifully sets it.
Programs using USER should instead use LOGNAME.