Use this syntax (both equivalent):
su - root
su -l root

You do have to specify the user with -l. Perhaps the man page could clarify that.

On Oct 31, 2008, at 11:33 AM, Frédéric Perrin wrote:

Hello,

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:
| [EMAIL PROTECTED]:~# echo $USER - $LOGNAME
| 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
anything...)

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 ?

--
Fred
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED] "


_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to