Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to get detailed information of certain file or folder;

  • File chmod changed date, which user?

How can i do this?

share|improve this question
    
Are you looking for audit information for the file? It's not exactly clear to me what you are looking for. –  Brent Pabst Jan 9 '13 at 15:42
1  
You might give ls -al or stat <filename> a try –  John K Jan 9 '13 at 15:47
    
Either you have to audit it or stat it when you want. –  Soham Chakraborty Jan 9 '13 at 15:51
    
I think stat reports more info about file for my needs. –  WishtobeNothing Jan 9 '13 at 15:59
    
Do you want to know about something that has already happened or are you looking to set something up to start monitoring files? Do you want to do this for a single file a directory or what ? –  Iain Jan 10 '13 at 6:57

2 Answers 2

You can try to use inotifywait

Try like this:

inotifywait -e attrib -m the_folder_to_watch

Where -e is the event to monitor, -m is monitor continuously.

See the blogpost here: http://en.positon.org/post/A-solution-to-the-umask-problem%3A-inotify-to-force-permissions

And the man for inotifywait: http://linux.die.net/man/1/inotifywait

share|improve this answer

There is no way to do this (that I know of, I could be corrected and learn something as well) unless you've installed a package to handle this. Meaning, if you didn't plan ahead and monitor a file, there is no way to get this information. All you'll be able to get from the file is the basic information that the stat <filename> cmd shows you, which wont show you what user altered a file.

That being said, in the future there are packages like audit that help you handle this and after you set a file to be audited, a simple ausearch -f <filename> would allow you to see this type of information. You could also use something like aide -- which I personally like.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.