Operating System - HP-UX
1748152 Members
3363 Online
108758 Solutions
New Discussion юеВ

Re: How to check what did the user do in HP-UX 11i v1

 
SOLVED
Go to solution
Bill Hassell
Honored Contributor

Re: How to check what did the user do in HP-UX 11i v1

This was recently discussed (how to add a time stamp to the shell history file. You can use the trap/debug technique described at the end of this link:

http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1375354

which requires changing all the user profiles. Or create this script:

#!/usr/bin/sh
set -u
for ACTIVE in $(who -q | grep -v users)
do
echo "## $(date)" >> ~$ACTIVE/.sh_history
done

This script uses who -q to get just a list of logged-in users, then appends the current date-time to .sh_history in their home directory. You can save this as a script and put it into root's cron to run a few times during the day.

Now everyone's .sh_history will be time stamped while they are logged in.


Bill Hassell, sysadmin
Gary L
Super Advisor

Re: How to check what did the user do in HP-UX 11i v1

Hi Bill

I have tried your way, that script worked but it looks like just one time use only.

I ran you script and ran bdf, ioscan -funC disk, cd / for test. In cmd history output, just bdf was marked timestamped, the other two like normal one without timestamped, details are as follows, how to use it?

# history
...
1063 /home/user/whodowhen.sh
1064 ## Tue Oct 6 16:35:04 EDT 2009
## Tue Oct 6 16:35:04 EDT 2009
## Tue Oct 6 16:35:04 EDT 2009
bdf
1065 ioscan -funC disk
1066 cd /
Gary L
Super Advisor

Re: How to check what did the user do in HP-UX 11i v1

Hi Hakki Aydin

Thanks a lot for your hyperlink above, I checked, found one look good and worked fine but need added two entried to each user's .profile file for all HP-UX servers.

-G
Bill Hassell
Honored Contributor

Re: How to check what did the user do in HP-UX 11i v1

> I have tried your way, that script worked but it looks like just one time use only.

You probably missed the comment about cron. This scriupt must be run several times each day. To do this, you place the script into root's cron and specify that it run every 2 hours or whatever time you would like to use. Here is an example of a cron entry:

0 1,5,10,15,20 * * * /usr/contrib/bin/timestamp.sh

The script will be run every 5 hours. This assumes that the script has been created and stored in /usr/contrib/bin as the file: timestamp.sh


Bill Hassell, sysadmin
Gary L
Super Advisor

Re: How to check what did the user do in HP-UX 11i v1

Got it thanks a lot.