1849294 Members
6260 Online
104042 Solutions
New Discussion

Detailed User History

 
Scott Williams_1
Occasional Contributor

Detailed User History

How can I add a date time stamp and ip address to roots and or the users sh_history file?
7 REPLIES 7
Victor BERRIDGE
Honored Contributor

Re: Detailed User History

Hi,
You will finish up corrupting .sh_history....
I dont think that its a good idea...
To another file perhaps?

All the best
Victor
Shaikh Imran
Honored Contributor

Re: Detailed User History

Hi,
Never used but i think you should also try
system auditing.
you can enable auditing from sam for any user/s including root.

Regards,

I'll sleep when i am dead.
Mobeen_1
Esteemed Contributor

Re: Detailed User History

Scott,
Doesn't last command give you that information...

I am not sure if its last or lastinfo...

we used to have that information on Solaris and AIX

regards
Mobeen
TommyT
Valued Contributor

Re: Detailed User History

Hi!
The usage of last command is.
last -R for sucessful logins whit user and timestamp
lastb -R for bad logins.

//Tommy
tompa
Geoff Wild
Honored Contributor

Re: Detailed User History

Here's what I do in root's .profile:

# Set up logging
HISTFILE=${HOME}/.sh_history_`who am i|awk '{ print $1}'`
date >>$HISTFILE
export HISTFILE
HISTSIZE=500
export HISTSIZE

Course, that only set's a date at login.

We have multiple admins, must su to root, that way each of us has our own sh_history...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Scott Williams_1
Occasional Contributor

Re: Detailed User History

The purpose of the sh_history file is to capture the commands users are envoking. I want to take it a step further and add a date/time stamp as well as ip address to it.

Thanks in advanace.
Victor BERRIDGE
Honored Contributor

Re: Detailed User History

Not only,
It is also so that you can recall the commands...
But if that doesnt bother you just add in the users .profile:
LOG=`who am i -R`
and as last line:
$LOG>>.sh_history

All the best
Victor