Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

Verifying initial logging session from root session

Shivkumar
Super Advisor

Verifying initial logging session from root session

Hi,

Initially logging as a normal user then switching over to root user i want to verify my original(initial) user id from root session.

What is the command for that ?

Thanks,
Shiv
8 REPLIES
A. Clay Stephenson
Acclaimed Contributor

Re: Verifying initial logging session from root session

Nothing more complicated than "who am i".

ORIG_USER=$(who am i)
echo "Original Login: ${ORIG_USER}"
echo "Current User: ${LOGNAME}"
If it ain't broke, I can fix that.
Arunvijai_4
Honored Contributor

Re: Verifying initial logging session from root session

Hi Shiv,

Your "uid" will be same. You can see using,

# id -u username

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Shivkumar
Super Advisor

Re: Verifying initial logging session from root session

Clay,

We use powerbroker to become root from a normal user. The command $who am i

didn't show the initial user id.

Thanks,
Shiv
Arunvijai_4
Honored Contributor

Re: Verifying initial logging session from root session

Hi Shiv,

Try using # id -u username. It should definitely help you.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Shivkumar
Super Advisor

Re: Verifying initial logging session from root session

Arun, That is what (username) i want to find from the root session.

Thanks,
Shiv
Arunvijai_4
Honored Contributor

Re: Verifying initial logging session from root session

Hi Shiv,

I am not sure this will be helpful to you, Try this, # whodo. It will display both root and normal user .

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Victor BERRIDGE
Honored Contributor

Re: Verifying initial logging session from root session

Hi Shiv,
As I dont use powerbroker it is just guess...
I believe since you use powerbroker, it has the privilege of granting root access to people entitled to... and so if you trace, the initator of su root would be the product itself...
But I believe because the product is well designed that it logs somewhere to whom it has give root access (and time and from where etc...)
So I would go into powerbroker's documentation if I were you


All the best
Victor
P.S.
Ive seen other products who execute programs/commands/etc... "as" do so because there are confgured as root in inetd.conf...
Frank de Vries
Respected Contributor

Re: Verifying initial logging session from root session

Just to make it complete:

By the way:
id -u username
and
who am i
(do not show the orginal login, contrary
what is said before)


who -um
root pts/0 Jul 11 11:31 . 12559 orasrv1

shows the orginal login
Look before you leap