I recently fatfingered my sudoers file on a Ubuntu 20.04 machine.
All commands involving sudo
failed with a core dump. Here's how I got it back:
I found a tip somewhere on stackoverflow: use pkexec
. This utilizes Policykit
(http://manpages.ubuntu.com/manpages/focal/man8/polkit.8.html).
In short: pkexec can run programs as root. In my case I had also to use pkttyagent
to
provide an authorization context. This works as follows (got it from: https://askubuntu.com/a/1053617)
- Open 2 termianl windows / ssh sessions.
- Get the PID of the shell process from the first one (
echo $$
) - Execute this in the second terminal:
pkttyagent --process (pid from step 2)
- Back to the first session, issue
pkexec viduso
- Enter the password in the second session.