sudo-project / sudo

Utility to execute a command as another user
https://www.sudo.ws
Other
1.17k stars 210 forks source link

`visudo`: Prevent locking yourself out #190

Open keks24 opened 1 year ago

keks24 commented 1 year ago

Hello!

Would it be possible to check the following syntax and intercept it?:

ALL ALL=(ALL) !ALL

I am thinking of a condition something this:

if(<command> == "!ALL" && <username_euid> == 0)
{
     printf("%s", "Not a syntax error, but do not lock yourself out!");
     <sudo_not_save_file>
}

A few sentences for insults`:

Having su or other alternatives as backup should be considered as a workaround solution.

-Ramon

PS: This emerged from the Gentoo User mailing list discussion: [gentoo-user] Update to /etc/sudoers disables wheel users!!!. Word pun intended. :smile: