nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Logging File Accesses

This is a discussion on Logging File Accesses within the Shell scripting forums, part of the Development/Scripting category; I have tried for quite some time now to work out a shell script on these lines. Actually came across ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-11-2006, 06:11 AM
Junior Member
User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
madz
Default Logging File Accesses

I have tried for quite some time now to work out a shell script on these lines. Actually came across this problem when i was going throught the commonly found abs-guide exercises
http://www.die.net/doc/linux/abs-gui...ngscripts.html


The script is to do the following:
********************************************
Log all accesses to the files in /etc during the course of a single day. This information should include the filename, user name, and access time. If any alterations to the files take place, that should be flagged. Write this data as neatly formatted records in a logfile.
*******************************************

Any help to get going in this direction will be great!

Thanks a lot
Reply With Quote
  #2 (permalink)  
Old 07-11-2006, 12:46 AM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
Default

Do you really wanna write script for this stuff? You can use automated tool such as tripwire. But let me know if you need script logic. I can provide you simple script logic.
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
  #3 (permalink)  
Old 08-11-2006, 01:54 AM
Junior Member
User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
madz
Default

Thanks rockdalinux for your help.

I could figure out the logic but was getting stuck on how to do it using shell scripting since unlike c programming you cannot get into the internal functions of the kernel to work on fd ( or am i mook on this?)

However i found the command that would help me going in this direction.

Its pretty simple once i got hold of the command and the switch.

In this case to get access of the /etc files and the users who did it, i used the lsof command as shown below:

lsof +D /etc

One can use +d if you do want only listing of the files at the first level only

Now l i can filter the data with awk and sed. :P

But i am thinking if i could write a deamon for the same so that the script runs continously and logs the data to a log file. I am still an novice in writing deamons and wrappers with shell scripts .

Now time to work on it!

Thanks rockdalinux for sharing your thoughts on my problem
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Read arguments from a file and pass them to binary file AHJ Shell scripting 1 31-10-2007 06:04 PM
Error while logging in the linux system vaibhav.kanchan Getting started tutorials 2 19-07-2007 09:27 PM
Call Logging and Asset Mgmnt SW ricc Linux software 1 29-06-2007 01:45 AM
convert pdf (ppt file) into wordppt file sureshbup Linux software 1 07-12-2006 03:51 PM
MRTG stops logging nathan86 Linux software 12 23-03-2005 07:14 PM


All times are GMT +5.5. The time now is 09:38 PM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38