LOL, when I started on OpenBSD, I created a bug report about this. Dev
want it this way, the're must be a reason to it but since it's not
standard, the must also expect question like this.
A answer why it's this way would be fine so user asking about this could
be refered to this answer.
Le 2012-11-12 10:38, Alessandro Baggi a écrit :
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.
--
Michel Blais
Administrateur réseau / Network administrator
Targo Communications
www.targo.ca
514-448-0773