[comp.unix.wizards] How do I detect who and when A file gets accessed ?

nieh@nnn.crd.ge.com (09/21/89)

I have an ASCII file which is owned by me. I constantly update the file.
Some of my colleagues will  aceess (read-only) this file regularly.
How do I detect who and when the file gets accessed ?
It is a very primitive bulletin board. I don't want to build programs
to manage this file.

Thanks,

--

Ko-Haw Nieh

General Electric Company            | nieh@crd.ge.com
Corporate Research and Development  | uunet!crd.ge.com!nieh
P.O BOX 8, K1-ES224 		    | FAX : 518-387-7258
Schenectady, NY 12301               | TEL : 518-387-7431  

maart@cs.vu.nl (Maarten Litmaath) (09/22/89)

nieh@nnn.crd.ge.com writes:
\I have an ASCII file which is owned by me. I constantly update the file.
\Some of my colleagues will  aceess (read-only) this file regularly.
\How do I detect who and when the file gets accessed ?
\It is a very primitive bulletin board. I don't want to build programs
\to manage this file.

One simple program is enough.  You let it register the user before accessing
the file.  In order to make it impossible to bypass the program, you make it
setuid and you chmod 600 the ASCII file.
One problem: to prevent race conditions when updating the user register,
you have to use some locking mechanism.
-- 
   creat(2) shouldn't have been create(2): |Maarten Litmaath @ VU Amsterdam:
      it shouldn't have existed at all.    |maart@cs.vu.nl, mcvax!botter!maart

gwyn@smoke.BRL.MIL (Doug Gwyn) (09/22/89)

In article <3322@solo10.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>One problem: to prevent race conditions when updating the user register,
>you have to use some locking mechanism.

Not if it is opened in append mode and a log entry is done with a single,
small write.

cpcahil@virtech.UUCP (Conor P. Cahill) (09/22/89)

In article <NIEH.89Sep21095615@nnn.crd.ge.com>, nieh@nnn.crd.ge.com writes:
> How do I detect who and when the file gets accessed ?

You can't detect who, and you can only detect the last time the file 
was accessed.  The only way to do it is to write your own program that
controls access to the file and have the program log who is using it.
-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+

pcf@galadriel.bt.co.uk (Pete French) (09/22/89)

From article <NIEH.89Sep21095615@nnn.crd.ge.com>, by nieh@nnn.crd.ge.com:
> 
> I have an ASCII file which is owned by me. I constantly update the file.
> Some of my colleagues will  aceess (read-only) this file regularly.
> How do I detect who and when the file gets accessed ?

A program called 'feel' wil do this for you - its kindd of the opposite of
'touch'. I have used this several times. But BSD dont appear to have it
(man feel doesnt give anything here). Last time I saw it was a VAX 11-750
running 32V.

-Pete.

-- 
       -Pete French.               | "She stares at the screen,
  British Telecom Research Labs.   |  At the little words of green,
 Martlesham Heath, East Anglia.    |  Tries to remember what to do next."
All my own thoughts (of course)    |                            -N.M.A.