Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

251
PSA: don't remove/rename /etc/sudoers, even if "just for a moment"
Post Body

I thought I should share this noobish thing I did yesterday, as a warning to others.

TL;DR: as soon as /etc/sudoers is gone, you can't sudo.

So, sudo package was upgraded, and as a result, a new config file (/etc/sudoers) had to be installed, but since I have modified mine, pacman saved the new version as /etc/sudoers.pacnew, and told me about it.

This is where pacman-specific part ends, the rest can happen on any distro, so bear with me. Having compared the two files with Meld, I have decided to copy my only change (uncommented wheel group) to the new file, then rename the old file to sudoers.old and then rename sudoers.pacnew to sudoers.

I naively assumed that sudo would let me do this, if I just stick to the same terminal session.. but no. The moment /etc/sudoers is gone, you can't do jack.

Well, I'll just Ctrl-Alt-F3 into a TTY, log in as root and correct the situation.. wait, I forgot my root password :) Anyway, my storage is not encrypted or anything, so I booted from the first Linux live USB I could find (Mint LMDE, not that it matters), mounted the partition and renamed /etc/sudoers.pacnew to /etc/sudoers.

So don't do this. Don't let /etc/sudoers be gone, even if just temporary, or you'll lose sudo until you fix it.

Author
Account Strength
100%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
23,129
Link Karma
2,750
Comment Karma
20,252
Profile updated: 6 days ago
:arch:

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago