Fixing a broken sudoers file

Need to open two SSH sessions to the server.

Step 1
Get the process ID of the shell from the first SSH session.

user@server:~$ echo $$
20486

Step 2
Start a PolicyKit authentication agent in the second session. Use the PID from the first step.

user@server:~$ pkttyagent --process 20486

Step 3
Open the sudoers file to be fixed in the first session by using pkexec

user@server:~$ pkexec vi /etc/sudoers

Step 4
Password prompt will appear in the second session. Login user account, user, needs to be a sudoer and type in its password.

user@server:~$ pkttyagent --process 20486
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/bin/vi' as the super user
Authenticating as: User,,, (user)
Password:

Setp 5
The sudoers file will be opened in the first session. Fix or update as needed.