which saves you the task of remembering to commit changes to your version
control system each time the package manager runs. This exception is
etckeeeper.
etckeeper takes all of your /etc directory and stores the configuration
files from it in a version control system repository. You can configure the
program by editing the etckeeper.conf file to store data in a Git,
Mercurial, Bazaar, or Subversion repository. In addition, etckeeper
connects automatically to the APT package management tool used by Ubuntu
and automatically commits changes made to /etc and the files in it during
normal software package upgrades. Other package managers, such as Yum,
can also be tracked when using other Linux distributions such as Fedora. It
even tracks file metadata that is often not easily tracked by version control
systems, like the permissions in /etc/shadow.
CAUTION
Using any version control system to track files that contain sensitive data
such as passwords can be a security risk. Tracked files and the version
control system itself should be treated with the same level of care as the
sensitive data itself.
By default, etckeeper uses Git. On Ubuntu, this is changed to Bazaar
(bzr) because it is the version control system used by Ubuntu developers.
Because this is configurable, we mention just the steps here and leave it to
you to adapt them for your particular favorite version control system.
First, edit /etc/etckeeper/etckeeper.conf to use your desired
settings, such as the version control system to use, the system package
manager being used, and whether to have changes automatically committed
daily. After etckeeper is installed from the Ubuntu repositories, it must be
initiated from the command line:
Click here to view code image
matthew@seymour:~$ etckeeper init
If you are only going to use etckeeper to track changes made to /etc
when software updates are made using APT, you do not need to do anything
else. If you edit files by hand, make sure you use your version control
system’s commands to commit those changes or use the following:
Click here to view code image
matthew@seymour:~$ etckeeper commit "Changed prompt style"
The message in quotes should reflect the change just made. This makes
reading logs and finding exact changes much easier later.