On Thu, Jul 21, 2011 at 4:17 PM, Michel Blais <[email protected]> wrote: > I use a temp user to login via ssh and after, use su to be root. Once I'm > root, if I try to change the password with passwd command, instead of > changing the root password, it change the password of my temp user. Typing > "whoami" tell me I'm root. > > I try "su" and "su -" and have the same result with both. I try 4.8 and 4.9 > version, both do the same. > > I don't think dmesg output is needed in this case but anyway : >
su changes your login name and that's what passwd reads with a getlogin(3) only if you run su as a session leader and supply an -L option to emulate a full login. the requirement to run it as a session leader means that the shell has to exec the process, not fork it (e.g. exec su -L) and substitute itself with it so that the new login name won't propagate any further upon exit. this looks quite reasonable to me.
