LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   How do i know my currently logged on userid in Solaris/Unix (https://www.linuxquestions.org/questions/solaris-opensolaris-20/how-do-i-know-my-currently-logged-on-userid-in-solaris-unix-537015/)

just_a_kid 03-13-2007 03:19 AM

How do i know my currently logged on userid in Solaris/Unix
 
Hi

Lets say i telnet using putty to my server
i logged in as normal ( lets say "guest" )

then i type "who am i"
This one works nice i know guest is logged on

but there is a problem
after i logged on as guest
i do "su - oracle" for example and provide correct password

how do i know that my "guest" userid already changed to "oracle"
i type who am i still "guest" is showing up.

Thanks.

timmeke 03-13-2007 04:13 AM

Try "whoami" rather than "who am i".

The first displays the effective user, the latter is an invocation of "who" (that displays logged on users, etc - see man who) and is equivalent to "who -m".

just_a_kid 03-14-2007 08:36 PM

apparently it is not working

i am using solaris

who - m will still give me username i logged on first time using putty
there is no whoami command in Solaris


any idea?
thanks

jlliagre 03-15-2007 12:23 AM

Quote:

Originally Posted by just_a_kid
there is no whoami command in Solaris

Actually this BSD command is supported by Solaris:
/usr/ucb/whoami
and so is its System V equivalent:
/usr/bin/id

Tinkster 03-15-2007 12:46 AM

Moved: This thread is more suitable in <Solaris> and has been moved accordingly to help your thread/question get the exposure it deserves.


All times are GMT -5. The time now is 05:39 PM.