Operating System - HP-UX
1833737 Members
2673 Online
110063 Solutions
New Discussion

Check Users's command and time(ip)

 
SOLVED
Go to solution
Byun Hee Joong
Contributor

Check Users's command and time(ip)

Is it possible to put IP Address or TIME(when user type the command)
in history file(.sh_history)

Because I'd like to check
multiple users's action and time(ip).

If it is not possible
let me know another method.
shell is O.K.

thanks~
5 REPLIES 5
Alessandro Pilati
Esteemed Contributor

Re: Check Users's command and time(ip)

Put in the .profile the following setting:

HISTFILE=/tmp/`who -u am i|awk '{ print $1"_"$8"_"$2 }'|sed 's/\///g'`.hist
So you will get, for each user that logs in the server, separate history files under /tmp
( foe example: /tmp/root_10.115.0.3_pts0.hist )

Regards,
Alex

if you don't try, you'll never know if you are able to
Mauro Gatti
Valued Contributor

Re: Check Users's command and time(ip)

Pheraphs you can find usefull to bring your system in trusted mode.
You will have importatn additional security features such as auditing or access restrictions (terminal, time and serial) you could use.

RGDS
Ubi maior, minor cessat!
Kent Ostby
Honored Contributor

Re: Check Users's command and time(ip)

THe auditing subsystems as well as the use of ACls will help you control the behaviour of and monitor your users.

Oz
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Alessandro Pilati
Esteemed Contributor

Re: Check Users's command and time(ip)

Byun,
this is an integration fo my previous reply:
don't forget the following line at the end of .profile:
export HISTFILE

Regards,
Alex
if you don't try, you'll never know if you are able to
Muthukumar_5
Honored Contributor
Solution

Re: Check Users's command and time(ip)

We can not add time or ip-address into .sh_history file . To suggest another method,

you can start new history file every IP-Address with time details as,

-- /etc/profile --
$HISTFILE=/var/history/.sh_history_$(who -mu | awk '{ print $NF }'

echo "$LOGNAME is logged @ $(date +'%d_%m_%y')"

---

It will create HISTFILE for every IP-Address and update time of starting session in the history file.

hth.






Easy to suggest when don't know about the problem!