When I « su - » to root (after being logged in as my normal user), the
LOGNAME env variable is still set to my previous user, as in :

| [EMAIL PROTECTED]:~% /usr/bin/su -l
| Password:
| root - fred

As far as I can tell, this contradicts the fine manual that says :

| -l      Simulate a full login.  The environment is discarded except for
|         HOME, SHELL, PATH, TERM, and USER.

So I would have expected LOGNAME to be either empty or set by some shell
startup script to be root. So, why is LOGNAME still equal to my previous
user ? (and where is it set ? « grep -r LOGNAME /etc » doesn't turn up

This is an issue because emacs, for instance, uses $LOGNAME to load the
init-file. I could always add « export LOGNAME=root » to my shell
startup file, but this doesn't quite feel right...

GNU su (as it is ocnfigured in Debian at least) resets LOGNAME to root
in the same situation. (and by the way, GNU su seems broken : if I « gsu
-l root », I always get a 'Password incorrect' answer).

As a side question, is it considered bad practice to set root's shell
and locales to something else then the default ?

freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to