This question already has an answer here:

I'm working on a server with several admin users. Each of them can use sudo to make configuration changes. We're keepeing our /etc directory version-controlled using etckeeper.

However, when I or another admin calls sudo etckeeper commit COMMITMESSAGE, git uses the root user's name and e-mail for the commit message. Setting git config user.name on the etc repository doesn't work in this case, because then each time etckeeper commit is called, the same data will be used.

What I want is the actual user's name and email be present in the etckeeper git repository, so that from the commit log I can track down who did which change.

Any help is greatly appreciated!

marked as duplicate by Ward, sysadmin1138 Aug 22 '13 at 21:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    That's strange, as the man page states Note that etckeeper commit will notice if a user has used sudo or su to become root, and record the original username in the commit. – Sven Dec 29 '12 at 17:36

I just tested this out and got this for my output on git log:

commit 1a8e8fb2952cd6e80f0a5211e8d4e8f698fbd02c
Author: ngrayson <ngrayson@<hostname>
Date:   Thu Jan 10 18:09:47 2013 +0000


So it looks like it should grab the user and not run it as root.

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