Linux - NewbieThis 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

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

Changing the write permissions could be only a temporary fix, depending on your situation.

My old firewall suddenly began experiencing a very similar issue. When AT&T took away my static IP (weenors), I had to run a DHCP client on my external interface. Then, every so often, my resolv.conf was overwritten. Chmod 000 was one of the first things I tried, but a permissions problem on resolv.conf can break connectivity under DHCP, so dhclient will change the permissions if required. The irregular intervals slowed my ability to diagnose the cause.

To make a short story longer, I couldn't stop it, so root ran a cronjob every five minutes to check the file and recreate it anytime it didn't contain the line I wanted. I figured that was a lazy way to do it, but I didn't know if dhclient has an option to leave resolv.conf alone, and I knew it's probably not a good idea to try.

Since I replaced the machine, I've been meaning to build the thing into a spare Linux box, but I've proven too lazy thus far, so I still have the script. Here's the first version, if it helps anyone:

Pretty basic, it doesn't even verify that the file exists. But if your resolv.conf is missing, you've got bigger issues anyway ;)

I copied the old file into the new, because of the frequency with which AT&T rearchitected their cable modem network and changed DNS servers. I wanted to keep the original file, so I renamed it with a timestamp, guaranteeing a traceable history. Of course, I knew I'd be looking at a ton of files soon, so I wrote v.2 (v.1.1?) that removed old copies. Changes to the variables section included:

Code:

LOGFILE=${2:-resolv.conf.log}
THRESH=14000000

The rest is simple enough; a subroutine checked each filename against $THRESH then passed or removed it. Any file older than the threshold was deleted. The backups were always the same, but they were small, so I played it safe and eventually settled on two weeks. Even safer (but probably overkill) was the logging of filenames and sizes as they were deleted. And no, that's not two weeks in seconds, but it's two weeks when you do the arithmetic on the timestamp.

Here are the files that existed when I decommissioned the fw. Note that it happened two times on Nov 2, only 40 minutes apart, then it didn't again for exactly 48 hours. Nice.