After reading the following two posts:

Trying to install an openVPN GUI messed up sudoers

Standards accounts are able to get root access using sudo without password request

I would like to learn how to perform a backup of /etc/sudoers file so that I can restore it in the event of a mess-up after installing a non-Ubuntu-package-ready software.

Any help would be much appreciated.


To backup:

sudo cp /etc/sudoers /etc/sudoers.backup

To restore:

sudo rm -rfv /etc/sudoers && sudo mv /etc/sudoers.backup /etc/sudoers

| improve this answer | |
  • 1
    +1 can't believe you are first to answer in 6 years. There is also the directory /etc/sudoers.d to backup. – WinEunuuchs2Unix Aug 4 '19 at 21:14

If /etc/sudoers is going to be a problem you probably should just keep all of /etc in version control since they're just some text files. Check this out:

| improve this answer | |
  • Thanks for your reply but I am still clueless after reading the page referenced by your URL. I do not know what "version control" and "git" mean. I am new to Ubuntu and yes, I am not an IT guy. I just wish to have a simple method of backing up /etc/sudoers file. – n00b Jul 9 '13 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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