LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-27-2011, 08:28 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Rep: Reputation: 33
How to find out who has modified/edited a file?


Background:

I use RadHat Linu5.

We usually log in to LINUX via putty (remote). Very often many people use the same user and password to log in.

My question:
I wonder how to tell who has edited/modified a file?

Any idea?

Thomas
 
Old 01-27-2011, 08:47 AM   #2
zer0signal
Member
 
Registered: Oct 2010
Location: Cleveland
Distribution: Slackware, Fedora, RHEL (4,5), LFS 6.7, CentOS
Posts: 258

Rep: Reputation: 29
Well the long way would to do a ls -l and check the modify date; once you have the time, you can then cat /var/log/securelooking to see who was on around that time.... and then trace the ip address to a workstation name. "if they are using different computers"
 
1 members found this post helpful.
Old 01-27-2011, 09:07 AM   #3
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Many thanks! This is what I want to know.
 
Old 01-27-2011, 09:21 AM   #4
zer0signal
Member
 
Registered: Oct 2010
Location: Cleveland
Distribution: Slackware, Fedora, RHEL (4,5), LFS 6.7, CentOS
Posts: 258

Rep: Reputation: 29
to clean up that secure log and look for exactly ssh attempts do:

cat /var/log/secure |grep "Accepted Password"

that should show who and what time and ip
 
Old 01-27-2011, 09:24 AM   #5
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Sorry, I have to add some comment:

Here is what I tried as you wrote.

I've created a file test.txt under /home/jb51/temp.

Code:
[root@s003ap19-test ~]# ls -la /home/jb51/temp/
total 3
drwxr-xr-x  2 jb51 jboss 1024 Jan 27 16:04 .
drwx------  3 jb51 jboss 1024 Jan 27 16:04 ..
-rw-r--r--  1 jb51 jboss   15 Jan 27 16:04 test.txt

One can also tell the IP-Address of my computer. But how can one confirm this file is modified by me, since the file name can not be found in /var/log/secure? Maybe at the same time someone else also loged in and created another file?

Code:
[root@s003ap19-test ~]# cat /var/log/secure
Jan 24 13:07:22 s003ap19-test sshd[11011]: Accepted keyboard-interactive/pam for jb51 from ::ffff:130.144.171.13 port 1600 ssh2
Jan 24 13:10:41 s003ap19-test sudo:     jb51 : /etc/sudoers is mode 0640, should be 0440 ; TTY=pts/0 ; PWD=/home/jb51 ; USER=root ; COMMAND=service jb51
Jan 24 13:10:52 s003ap19-test sudo:     jb51 : /etc/sudoers is mode 0640, should be 0440 ; TTY=pts/0 ; PWD=/home/jb51 ; USER=root ; COMMAND=service jb51
Jan 24 13:13:09 s003ap19-test sudo:     jb51 : /etc/sudoers is mode 0640, should be 0440 ; TTY=pts/0 ; PWD=/home/jb51 ; USER=root ; COMMAND=service jb51 status
Jan 24 13:17:16 s003ap19-test sudo:     jb51 : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/jb51 ; USER=root ; COMMAND=service jb51 status
Jan 26 14:23:49 s003ap19-test sshd[25677]: Accepted keyboard-interactive/pam for jb51 from ::ffff:130.144.171.13 port 4797 ssh2
Jan 27 16:04:12 s003ap19-test sshd[720]: Accepted keyboard-interactive/pam for jb51 from ::ffff:130.144.171.13 port 3128 ssh2
[root@s003ap19-test ~]#

Last edited by thomas2004ch; 01-27-2011 at 09:29 AM.
 
Old 01-27-2011, 09:25 AM   #6
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by zer0signal View Post
to clean up that secure log and look for exactly ssh attempts do:

cat /var/log/secure |grep "Accepted Password"

that should show who and what time and ip
I tired this but got nothing shown :
Code:
[root@s003ap19-test ~]# cat /var/log/secure |grep "Accepted Password"
[root@s003ap19-test ~]#
 
Old 01-27-2011, 09:34 AM   #7
zer0signal
Member
 
Registered: Oct 2010
Location: Cleveland
Distribution: Slackware, Fedora, RHEL (4,5), LFS 6.7, CentOS
Posts: 258

Rep: Reputation: 29
sorry

try

cat /var/log/secure |grep "Accepted password"

lower case 'p' =P
 
Old 01-27-2011, 09:40 AM   #8
zer0signal
Member
 
Registered: Oct 2010
Location: Cleveland
Distribution: Slackware, Fedora, RHEL (4,5), LFS 6.7, CentOS
Posts: 258

Rep: Reputation: 29
As for who modified, I dont know because everyone uses the same login id.. Off the top of my head would be to cross reference IP address, and login time, and date modified stamp of file.. To get a close idea of who it might be...

Maybe someone else here might know of a way to def tell who modified it.

But with it being the same login ID for each SSH session... This the only way I am able to think of to try and get as close as you can to who it was...
 
  


Reply



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
Find who modified the permission to a file ++nick++ Linux - Newbie 11 10-07-2009 12:50 AM
find command to search file modified b-RAM Linux - General 3 05-26-2009 11:39 PM
Any way to find who last edited a file? rusty_turkey Solaris / OpenSolaris 12 04-24-2008 11:17 AM
Find out if a file was modified in the last 2 minutes.... cricos Programming 5 04-06-2005 02:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:01 AM.

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