Hi list,
today, I've logged on my openbsd box, and when I change the root password I get this:


$ uname -pmrsv
OpenBSD 5.1 GENERIC.MP#207 amd64 amd64
$ whoami
userlog
$ echo $USER
userlog
$ su
Password:
# passwd
Changing local password for userlog.
New password:
Password unchanged.
# echo $USER
userlog
#


Logging in with an user called "userlog", get su, run passwd as root, it says that i'm changing password for userlog.

From manual page I get:


By default, the environment is unmodified with the exception of LOGNAME,
     HOME, SHELL, and USER.  HOME and SHELL are set to the target login's
default values. LOGNAME and USER are set to the target login, unless the
     target login has a user ID of 0 and the -l flag was not specified, in
     which case it is unmodified.  The invoked shell is the target login's.
     This is the traditional behavior of su

Running "su -l" works good.

Why if user ID is == 0 or if there's no -l, the $USER will not be set? What is the policy?

I've tried this also on OpenBSD 4.9 with same result.

Thanks in advance.

Alessandro.

Reply via email to