I tried to do what I thought the comments in /etc/sudoers was telling me:
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
Then:
: ~ ; visudo --help
visudo - safely edit the sudoers file
usage: visudo [-chqsV] [-f sudoers] [-x file]
But I didn't read the bit after that more carefully, so I typed:
sudo visudo -x /etc/sudoers.d/dci
Instead of
sudo visudo -f /etc/sudoers.d/dci
Now, I'm stuck. Any command I try to do with sudo
gives me:
>>> /etc/sudoers.d/dci: syntax error near line 1 <<<
>>> /etc/sudoers.d/dci: syntax error near line 1 <<<
>>> /etc/sudoers.d/dci: syntax error near line 2 <<<
…
>>> /etc/sudoers.d/dci: syntax error near line 58 <<<
sudo: parse error in /etc/sudoers.d/dci near line 1
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
And without sudo, unsurprisingly:
: ~ ; rm /etc/sudoers.d/dci
rm: remove write-protected regular file ‘/etc/sudoers.d/dci’? y
rm: cannot remove ‘/etc/sudoers.d/dci’: Permission denied
How do I fix this?
Update:
After trying the solution from this question, I got the following result:
: ~ ; pkexec visudo
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/sbin/visudo' as the super user
Authenticating as: DCi Admin,,, (dci)
Password:
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized
This incident has been reported.
I was guessing this was because I was supposed to be using root password, but that's possibly a wrong guess.
This solution then fixed that problem.