1

/etc/sudoers had been deleted, and I wanted to restore the default file from the package. I tried: apt-get install sudo apt-get install --reinstall sudo apt-get remove sudo && apt-get install sudo None of which worked but all of which warned about /etc/sudoers not existing.

In the end I did apt download sudo && ar xv sudo && tar xf data.tar.xz ./etc/sudoers and just copied that file to /etc/sudoers, but was there a more straightforward way to restore the file?

2

1 Answer 1

4

You can extract the contents of a .deb package as follows:

dpkg-deb --extract sudo_1.8.26-2_amd64.deb /tmp/sudo

This extracts the contents of the .deb into /tmp/sudo/. Now you can copy /tmp/sudo/etc/sudoers.

Alternatively you could run dpkg -i --force-confmiss sudo_1.8.26-2_amd64.deb. This forces reinstalling missing conffiles.

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