LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-08-2012, 08:25 AM   #1
the_gripmaster
Member
 
Registered: Jul 2004
Location: VIC, Australia
Distribution: RHEL, CentOS, Ubuntu Server, Ubuntu
Posts: 360

Rep: Reputation: 38
Lightbulb Using Git to track changes to the /etc dir


The common practice of managing config files in the /etc dir is to make backup copy of a config file before making changes to it. The problem with this simple method is you soon end up with multiple different files of the same config file in the dir. Not only does it clutter the /etc and its subdirectories, also takes up unnecessary space (although negligible).

I was wondering if it is a good idea to use Git instead to keep track of the different versions of the config files?

HOW?
Suppose making a change to /etc/ssh/sshd_config to set PermitRootLogin to No, follow these steps (in this example just using the Git to turn the /etc/ssh/ dir only as a repo, not the whole /etc):

1. cd /etc/ssh
2. git init
3. git add *
4. sed -i 's/PermitRootLogin.*/PermitRootLogin No/' /etc/ssh/sshd_config
5. git commit -m "Changed root login to no"

Now, at a later time, to see what was changed:
1. cd /etc/ssh
2. git diff --color-words

Code:
diff --git a/sshd_config b/sshd_config
index 849e181..7b144c3 100644
--- a/sshd_config
+++ b/sshd_config
@@ -38,7 +38,7 @@ SyslogFacility AUTHPRIV
# Authentication:

#LoginGraceTime 2m
#PermitRootLogin YesPermitRootLogin No
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#PermitRootLogin Yes
will show as red (indicating it was removed)
PermitRootLogin No
will show as green.

Of course there are other options.

There is also the possibility of creating a patch file, among other options.

Last edited by the_gripmaster; 04-08-2012 at 10:19 AM. Reason: how to do it in Git
 
Old 04-09-2012, 07:10 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Sounds like a good idea, I suppose this would help if you had different people managing the same hosts, they could also put change numbers in the commit log.
 
  


Reply

Tags
git


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] git push in a git-init without --bare option? xeon123 Linux - Newbie 1 06-27-2011 03:44 AM
[SOLVED] Can't install Git repo (I don't git git ) Nemus Linux - Software 3 05-20-2011 02:09 PM
SBo-git - slackbuilds.org on git (with patches for current) ponce Slackware 47 03-12-2011 05:12 AM
inconsistency issue of git-clone ***/git/mesa/drm with the existing kernel source centguy Linux - Desktop 2 10-08-2008 10:36 PM
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 02:57 PM


All times are GMT -5. The time now is 01:26 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration