Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to figure out why, after a etckeeper commit, I had a problem with rebooting (already solved thanks to this great thing).

I played with etckeeper, did git checkout some_commit_sha for a quick look and then git checkout master.

And it seems my file permissions in /etc were broken after those manipulations. All files including ssh_host_rsa_key passwd-, shadow- were rw-r--r--. I didn't know Git does not save file permissions.

Now I fixed all of them (I hope I didn't miss anything).

What was the right way to get earlier states of /etc, look around, and go back to the master with the right file permissions?

share|improve this question
up vote 6 down vote accepted

According to the documentation (see below) you have to run

etckeeper init

after checking any files back out in order to restore permissions. git can't store file permissions directly so it's handled by etckeeper and you need to run the init again to restore them after a checkout.

Documentation section,

You can use any git commands you like, but do keep in mind that, if you check out a different branch or an old version, git is operating directly on your system's /etc. If you do decide to check out a branch or tag, make sure you run "etckeeper init" again, to get any metadata changes:

git checkout april_first_joke_etc

etckeeper init

share|improve this answer
This is good to know. He kind of had a two part question. The right way to "look around" and also the right way to restore the permissions. Wouldn't the right way to "look around" be to clone the /etc git repo to another directory and do diff and checkouts there until the root cause of his reboot troubles could be solved? – iPaulo Jul 7 '11 at 14:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.