Safely Changing Existing Configuration Files

Sometimes it's desirable to alter an existing configuration file or startup script. Doing so is potentially risky, though. An error could result in an unbootable system or in a system that doesn't work as you expect. Some rules to keep in mind when editing these files include:

Make a Backup Be sure to make a backup of the file before you edit it. Some editors do this automatically, but if you save your changes more than once, the second save may overwrite the original backup.

Edit the File in Linux Some other OSs, such as Windows, use different end-of-line conventions in their text editors than does Linux. Some configuration files are sensitive to these conventions, so editing a file in Windows may result in a file that doesn't work as you expect, possibly halting the boot process.

Note Ownership and Permissions Before editing the file, notice who owns it and what the permissions are. Be sure that the edited file has the same ownership and permissions.

Make Minimal Changes Don't change anything you don't understand, and try to change as little as possible of what you do understand.

Change Support Files, Not Core Files If a SysV startup script or other file relies on variables loaded from another file, try to edit the support file rather than the primary file. As a general rule, you'll be less likely to introduce serious problems if you edit a support file.

Test the Changes If possible, test the modified script or configuration file as soon as possible. For instance, shut down and restart a server. If you make extensive changes to startup scripts, you might even want to reboot the computer to be sure it boots correctly. With the changes fresh in your mind, you'll find it easier to correct problems than if you'd waited hours, days, or longer to test them.

0 0

Post a comment