LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-13-2012, 02:16 AM   #1
jayakumar01
Member
 
Registered: Nov 2011
Posts: 106

Rep: Reputation: Disabled
how to check logs of hosts conf file


Hi

In my production server im facing problem that frquently some one disabling vi /etc/hosts conf file. i had check out /var/log/messages i never got any symptom of that . i also check /var/log/xferlog that to i does int getting of any logs of modified details of hosts file.How can i place log for monitoring the last date of hosts file modified
 
Old 01-13-2012, 02:20 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

What exactly do you mean by disabling vi /etc/hosts? Are you the root user/administrator of that system?

Kind regards,

Eric
 
Old 01-13-2012, 04:39 AM   #3
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by jayakumar01 View Post
Hi

In my production server im facing problem that frquently some one disabling vi /etc/hosts conf file. i had check out /var/log/messages i never got any symptom of that . i also check /var/log/xferlog that to i does int getting of any logs of modified details of hosts file.How can i place log for monitoring the last date of hosts file modified
I have never heard disabling hosts file

or do you mean someone without your knowledge makes changes in hosts file?

you can use this command to check modification of file

Code:
#stat /etc/hosts
 
Old 01-13-2012, 06:28 AM   #4
jayakumar01
Member
 
Registered: Nov 2011
Posts: 106

Original Poster
Rep: Reputation: Disabled
Hi,
we had enabled root priviledge for few user .i found one of the user keep on changing the hosts file making out the database to fall .we are connected our server by using localhost in mysql.so server instant automatically getting stopping off .how can i get log if any one change the conf file of hosts .it seems the hosts modified logs never falls on anywhere on the system.how can i enable to get alert any one modified the hosts conf file
 
Old 01-13-2012, 06:41 AM   #5
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
As per the answer of your question I don't believe any log file even if any exists can tell you what changes has been made.

As you said your server stops due to changes in hosts file you can check the hosts file using the stat command and ask the user not to make any changes without the permission of admin.

and any how hosts is not a .conf file so I don't believe there can be any log file but you can always look out for positive replies from other members here.

But my suggestion is what i said above.
Code:
#stat /etc/hosts
  File: `/etc/hosts'
  Size: 263             Blocks: 16         IO Block: 4096   regular file
Device: 801h/2049d      Inode: 2082828     Links: 2
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-01-13 13:58:02.000000000 +0530
Modify: 2012-01-11 23:37:07.000000000 +0530
Change: 2012-01-11 23:37:07.000000000 +0530
look out for the user who is making changes and take appropriate action

Best of Luck

Last edited by deep27ak; 01-13-2012 at 06:50 AM.
 
Old 01-13-2012, 08:08 AM   #6
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by jayakumar01 View Post
Hi,
we had enabled root priviledge for few user .i found one of the user keep on changing the hosts file making out the database to fall .we are connected our server by using localhost in mysql.so server instant automatically getting stopping off .how can i get log if any one change the conf file of hosts .it seems the hosts modified logs never falls on anywhere on the system.how can i enable to get alert any one modified the hosts conf file
Hi,

One advice: limit root access to a strict minimum and setup sudo. Change file attributes on files you don't want to be changed.

If you set it up like that you could install syslog-ng and configure it to process your logs which can even send you mails. That'll save you a lot of trouble.

Kind regards,

Eric
 
1 members found this post helpful.
Old 01-13-2012, 10:36 AM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by jayakumar01 View Post
Hi,
we had enabled root priviledge for few user .i found one of the user keep on changing the hosts file making out the database to fall .we are connected our server by using localhost in mysql.so server instant automatically getting stopping off .how can i get log if any one change the conf file of hosts .it seems the hosts modified logs never falls on anywhere on the system.how can i enable to get alert any one modified the hosts conf file
You can write a script using inotify, but what you're asking is really pointless.

If the user has root access, they can easily go in and disable/edit ANY logging you put in place, rendering all your efforts ineffective. EricTRA gave the best advice: limit root access, and if you're having problems with a particular user, take away their rights, and don't give them back. You can also use sudo to limit the commands they can run to a certain few, giving them root access to just a few commands, but not able to run anything else, like "vi /etc/hosts", or the like.
 
2 members found this post helpful.
  


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
Postfix DNS: Why does it not check my hosts file? hydraMax Linux - Server 1 03-23-2011 12:33 AM
hosts conf. file - how to enable subdomains for testing? rotten_yellow Linux - Server 1 06-14-2008 11:48 PM
DNS Hosts.conf or resolv.conf problem mac_casey SUSE / openSUSE 0 03-26-2006 09:21 AM
/etc/hosts, /etc/resolve.conf and /etc/host.conf config probs below_average Linux - Networking 1 12-08-2004 10:07 PM
Can you guys check my Samba conf file? gsmonk Linux - Networking 1 09-19-2003 07:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

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