1834512 Members
2113 Online
110068 Solutions
New Discussion

visiting a directory

 
SOLVED
Go to solution
Shivkumar
Super Advisor

visiting a directory

Dear Sirs,

Is there a way to find out whether any particular user has read a file or visited a particular directory ?

Thanks,
Shiv
6 REPLIES 6
Adisuria Wangsadinata_1
Honored Contributor

Re: visiting a directory

Hi Shiv,

You can turn on the history for this purpose. Check the thread at this url below :

http://forums2.itrc.hp.com/service/forums/questionanswer.do?threadId=865864

Hope this can help you.

Cheers,
AW
now working, next not working ... that's unix
Indira Aramandla
Honored Contributor

Re: visiting a directory

Yes, if you truned on the history then you can view the .sh_history fiel to see the recent commands executed by a particular user.

This file exists in the user's home direcotry.

IA
Never give up, Keep Trying
Rajeev  Shukla
Honored Contributor
Solution

Re: visiting a directory

Otherway is to enable the accounting on the system using SAM you can do that.
But remember to have enough space in /var as it will grow your log file to huge size.
Have a look at the man pages of acct(1M)
man 1m acct

Cheers
Rajeev
Vibhor Kumar Agarwal
Esteemed Contributor

Re: visiting a directory

One option might be:

Add script log_file
at the end of .profile of all users.

Now whatever they will do will be recorded in it.

At the end you can do
grep Path_to_check log_file
Vibhor Kumar Agarwal
Mahesh Kumar Malik
Honored Contributor

Re: visiting a directory

Hi Shiv

First option is to turn on history

Second one is use auditing if your hpux OS environment is in Trusted (secured) mode then auditing feature will enable you to browse through system activities

Regards
Mahesh
Muthukumar_5
Honored Contributor

Re: visiting a directory

You can try with shell wrapper as,

#!/bin/ksh
#!/bin/ksh
CD=/usr/bin/cd

(
printf "$(date) $LOGNAME OLDDIR=$PWD ";
${CD} $@
printf "NEWDIR=$PWD\n"
) >> /tmp/cdlog.$(date +'%b_%d_%y')

exit 0
# END #

Put this file in /usr/sbin/cd
# chmod 755 /usr/sbin/cd
# chown bin:bin /usr/sbin/cd

Put this in /etc/profile file.
# alias cd='/usr/sbin/cd'

You can see log files are created in /tmp/cdlog. with informations.

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