1
$ whoami
a
$ su b
Password: ...
$ whoami
b
Is there a whowasi
command? Some way to find out that I was user a
before I had become user b
?
1
$ whoami
a
$ su b
Password: ...
$ whoami
b
Is there a whowasi
command? Some way to find out that I was user a
before I had become user b
?
3
Technically, you didn't switch users; you opened a separate shell process as b
. You can suspend it with suspend
, use whoami
, then return with fg
.
You can check the owner of the parent process with ps -f $PPID
.
Use who -m
or who am i
to see the user you originally logged in as. (This is different from the above two methods because it always returns the same user despite how many times you run su
.)
Use ps -f
to see all processes running on the current tty, including their owners.
0
You can do a who
to see what user is the original owner of the session
The
who am i
is exactly what I want. I hadn't realized it returns a different answer fromwhoami
. – chrisaycock – 2011-03-25T20:07:59.150