Re: su and passwd

2012-10-17 Thread Massimo Pignoloni

Hi
you can use passwd root, after su, or use su - that simulate a 
full login and the command passwd.

Massimo
Il 12/11/2012 16.38, Alessandro Baggi ha scritto:

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.




Re: su and passwd

2012-09-14 Thread Ted Unangst
On Mon, Nov 12, 2012 at 16:38, Alessandro Baggi wrote:

 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

^

That's the way it used to work, that's the way it's going to work.

 
 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?



Re: su and passwd

2012-09-14 Thread Michel Blais
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



Re: su and passwd

2012-09-14 Thread Michel Blais

Oups, didn't saw that Trd answered. Sorry for the noise.

Le 2012-09-14 13:49, Michel Blais a écrit :
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