So I've got an Azure VM where I wanted to copy a file into an /etc/sudoers.d/ folder. Obviously I've tested the file before copying it, however something weird must have happened when transferring it via SSH, it might have been corrupted on the fly (should have checked with MD5 in the destination).
$ sudo ls /etc/sudoers.d/ >>> /etc/sudoers.d/10-backup-db-test-restore: syntax error near line 1 <<< sudo: parse error in en_US.UTF-8 near line 1 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin
I've googled around and there only seems to be 2 solutions to this:
- Rebooting in recovery mode: something which I guess I cannot do because this server is an Azure VM.
- Trying pkexec, but it doesn't work! See below:
Error when launching pkexec:
$ pkexec nano /etc/sudoers.d/10-backup-db-test-restore ==== AUTHENTICATING FOR org.freedesktop.policykit.exec === Authentication is needed to run `/bin/nano' as the super user Multiple identities can be used for authentication: 1. Ubuntu (user1) 2. ,,, (user2) Choose identity to authenticate as (1-2): 1 Password: polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie ==== AUTHENTICATION FAILED ===
I don't understand why pkexec doesn't work, I entered the password for user1 correctly!
Any way to reboot an Azure VM into recovery mode?