su problem

Markus Schönhaber ubuntu-users at list-post.mks-mail.de
Mon Jun 28 15:30:50 UTC 2010


28.06.2010 16:53, Leander Jedamus:

> su does not work as expected. When I am user1 and do a "su - user2", I 
> don't get a shell for that user and i am not user2. How can this be done?

Hm, works fine form me on lucid:

mks:~$ pwd
/home/mks
mks:~$ su - test
Passwort:
test:~$ pwd
/home/test
test:~$ whoami
test

but

test:~$ who am i
mks      pts/5        2010-06-28 14:37 (:0.0)
test:~$

The latter is due to the fact that "who am i" prints the name of the
user who's recorded to be logged in on the terminal connected to "who"'s
stdin.
If that's what you mean by "I am not user2": it's completely normal.
Otherwise you should describe what exactly happens and how you determine
that the effective user ID has not changed.
And take a look at
/var/log/auth.log
Any errors which may have occurred during su invocation should be
recorded there.

BTW: A more Ubuntu-ish way to get another user's shell would be
sudo -i -u user2




More information about the ubuntu-users mailing list