LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-25-2008, 04:04 AM   #1
ginda
Member
 
Registered: Mar 2004
Distribution: SUSE8.2, 9.2, Knoppix
Posts: 323

Rep: Reputation: 31
editing a link file?


Hi everyone

this may sound like a stupid question but it just came to mind and thought id ask around...

is it possible to editing a soft/hard link file i.e. the one that is created using the ln command?

and is it possible to also get it to execute a command whenever some use the link i.e. cd into the soft link which takes them to the actual directory but also updates a log with time of access.


thanks in advance
 
Old 04-25-2008, 04:40 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Hello,
I'm not sure what you mean by editing link. You can use the ln command to redirect the link elsewhere.
The inotify interface can be used to trigger a command whenever a link is accessed:
http://en.wikipedia.org/wiki/Inotify
 
Old 04-25-2008, 05:06 AM   #3
ginda
Member
 
Registered: Mar 2004
Distribution: SUSE8.2, 9.2, Knoppix
Posts: 323

Original Poster
Rep: Reputation: 31
Thanks for your help, inotify is not availble on the red hat server in question is there another way?

If this is not possible is it possible to run a script when a particular service or daemon is called?
 
Old 04-25-2008, 05:49 AM   #4
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Everything is possible. You just have to know precisely what you want to do and to do it.
inotify is on every linux kernel after 2.6.13 For older kernels, there is dnotify.
 
Old 04-25-2008, 07:53 AM   #5
ginda
Member
 
Registered: Mar 2004
Distribution: SUSE8.2, 9.2, Knoppix
Posts: 323

Original Poster
Rep: Reputation: 31
Basically the issue that got me thinking a little was we suspect one of the I.T guys are messing with some of the red hat servers but want to catch him in the act, the act is various issue i.e. accessing certain files or logs, i want to run some commands on the server to monitor certain things but not from the obvious place i.e. cron at anacron as the I.T guy is well versed in linux and would prob catch on to us.

I have noticed that certain daemons or services run once a day, week or month but wanted to run my monitoring scripts from these trigger events if that makes sense???? stuf like w, top, netstat etc.

Is this possible?

Thanks
 
Old 04-25-2008, 09:03 AM   #6
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
I get a fuzzy idea about what you are trying to do, but it's not cristal clear to me.
I got that you were trying to monitor the file activities of a daemon that runs periodically. Is that correct?
Why doesn't dnotify or inotify do the job? What didn't I get?
 
Old 04-25-2008, 09:34 AM   #7
marquardl
Member
 
Registered: Apr 2008
Posts: 100

Rep: Reputation: 15
Assuming that your intentions are legal, meaning that you are officially backed by your bosses, there are certain things you could do.

The most easiest thing to do would be to regularly monitor the bash history file of that person to see what commands he he/she has issued. You need access to his account or root privilege.

You could use a modified shell application that logs all his actions without keeping these from being done. You must modify his user settings to use that shell as a default. He/she could find out about this when accessing /etc/passwd. Or modify the shell to log only when he/she is logged in, and replace the default shell with this modified one (affects all users).

Or if the person accesses logfiles for reading with, for example, less, then use a modified less to log events when certain files are accessed.

Modifying common tools to do some extra logging will also generate evidence.

Replacing the links with links to certain a script that acts/redirects data/contents from the original files is problematic. Easy to find out for the person that something is going on and difficult to mimic (for example plain text files during editing with vi, or something like that).

That's what I would do, if the amount of the person's "criminal activity" justifies the amount of work that has to be implemented to catch him.

Or just have a talk with him/her. Knowing that he/she is being monitored could put a hold on all that activity and solve the situation as well.

Server issues

Last edited by marquardl; 05-01-2008 at 05:14 AM.
 
Old 04-25-2008, 09:42 AM   #8
ginda
Member
 
Registered: Mar 2004
Distribution: SUSE8.2, 9.2, Knoppix
Posts: 323

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by Agrouf View Post
I get a fuzzy idea about what you are trying to do, but it's not cristal clear to me.
I got that you were trying to monitor the file activities of a daemon that runs periodically. Is that correct?
Why doesn't dnotify or inotify do the job? What didn't I get?

Ive tried looking for the command dnotify but could find it even as root user? could you give me dummy instructions..
 
Old 04-25-2008, 09:46 AM   #9
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
The inotify interface is not a command. It is an API to monitor files. If you are looking for a command, you should look at the inotify-tools:
http://inotify-tools.sourceforge.net/
 
  


Reply


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
read-only file system error when editing a config file smallfrowne Linux - Newbie 5 02-19-2008 07:06 PM
How to create symbolic link to html file and avoid page link problem? haxpor Linux - General 2 01-29-2008 08:40 AM
I want to make a link from word in one file to a different file using Ubuntu linux gilbert.baumslag Linux - Newbie 3 01-11-2008 02:32 PM
editing a very large HTML file (or, extracting URLs from a file) Chriswaterguy Linux - Software 3 11-27-2007 07:07 PM
Editing a symbolic link twallstr Linux - General 1 11-09-2005 03:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:19 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration