Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-14-2010, 10:55 PM
|
#1
|
Rogue Class
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 376
Rep: 
|
trace writes to file
Does Linux have a way to trace writes to a file?
For each write, I would like to know the time, date, process id, user, file position, byte count, and the data written.
I could use this with a script to replay the writes to a backup of the original file, and reproduce the file contents as they were at a point in time.
-Ben
|
|
|
02-15-2010, 01:51 AM
|
#2
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep: 
|
It is not clear what you mean by "write". Its meaning in computer science is a bit general for your use. Can you be specific about what you want to do? Right now it looks like you are trying to write spyware.
Perhaps you want a simple output to get recorded to a log, along with details about what it is. May be useful in debugging. An example would be the syslog. This immediately suggests logger(1).
Generally you'd have to write the script to produce the log file you needed.
|
|
|
02-15-2010, 11:20 PM
|
#3
|
Rogue Class
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 376
Original Poster
Rep: 
|
I mean the write() system call. I am not considering memory mapped I/O. The write() system call is logged by the strace command, but that is per process. I want to find something that is per inode.
Just as an example, I may have an mbox file that could be written to directly from any number of processes including Thunderbird, mutt, and imapd. I would like to be able to tell what was written by Thunderbird, and what was written by mutt.
How would I write a script to do this? I assure you that I am only going to use this on my own computer.
Thank you,
-Ben
|
|
|
11-28-2010, 09:46 AM
|
#4
|
Rogue Class
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 376
Original Poster
Rep: 
|
In BSD this would be done with systrace. In SELinux it can be done with an auditallow policy. This thread solved by SELinux.
|
|
|
12-05-2010, 11:30 AM
|
#5
|
Rogue Class
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 376
Original Poster
Rep: 
|
p.s.
There is also auditd(1)
|
|
|
All times are GMT -5. The time now is 05:24 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|