Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

keeping a log of user typed commands...

SOLVED
Go to solution
chindi
Respected Contributor

keeping a log of user typed commands...

Hi Guys,
i would like to maintain a log of all typed commands on my producn..
for which i have already shifted the sh_history variable in /etc/profile to a different locn...for all users...

but now th problem is i have a user called xyz...
he logs in and then he uses su - test



to log into my application...
where he fires all the commands ...related to my application ...i would like to keep a record of it....

Bcoz nw the probl is my history record shows the comands typed the applicn user which is a common user...used by atleast 4-5 people at a time..
so m not able to keep a trace of who typed whch command...


i would like to have ...
xyz_test_history commands in my log file ...

HPUX 11i v2 ..6600 ....
2 REPLIES
Richard Hepworth
Esteemed Contributor
Solution

Re: keeping a log of user typed commands...

Hi,

Set your sh_history location as follows (in /etc/profile):

LOGINNAME=`who am i | awk '{print $1}'`
HISTFILE=/tmp/hist.${LOGINNAME}.$LOGNAME.$$

You can also track who su'd to different users in /var/adm/sulog

regards,

Richard
Sajjad Sahir
Honored Contributor

Re: keeping a log of user typed commands...


Dear Chindi

who is trying to su it will be log in to sulog files.

it is under /var/adm directory

thanks and regards

Sajjad