Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-19-2006, 12:19 AM   #1
Registered: Sep 2004
Distribution: Debian Testing / Unstable
Posts: 180
Blog Entries: 1

Rep: Reputation: 32
Is there any way to tell which user last accessed a file?

I have a script that monitors access to files (using 'stat' to get the access time) but I couldn't find any switches to show the user which performed the access.

I know about 'fuser' and 'lsof' but those commands identify open files
and I just want to check last (completed) access.

Any help would be appreciated. Thanks in advanced!
Old 10-19-2006, 12:30 AM   #2
Senior Member
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
I suppose you can look at each user's home directory and find their .bash_history file
Old 10-19-2006, 02:28 AM   #3
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint, Tribblix
Posts: 9,754

Rep: Reputation: 457Reputation: 457Reputation: 457Reputation: 457Reputation: 457
That depend on the O/S.
You'll need some kernel tracing facility.
Under Solaris 10+ or the latest MacOS/X, a simple DTrace script would do the job.
Under Linux, nothing equivalent exists. Simpler experimental ways to explore are KProbes, LTT, DProbes, SystemTraps and probably others.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning permissions for a file to be accessed by particular users praveen kumar Linux - Networking 3 05-18-2006 11:20 AM
file created/accessed dates plainkeyman Linux - General 4 10-27-2005 08:34 PM
user home directorys can't be accessed anymore r_squared Linux - General 1 01-04-2005 09:35 PM
Slack 9: mounted FAT32 partitions cannot be accessed by normal user Obi-Wan_Kenobi Slackware 6 07-13-2003 12:15 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:56 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration