Although there are many answers to this problem, the scenario is different here:
I’m using Ubuntu 18.04 on Azure.
By mistake, I made sudoers
file world-writable (sudo chmod o+w /etc/sudoers
). There is an appropriate way to fix.
For this, I need an Ubuntu user’s password
output:-
ubuntu@azurevm:~$ ls -la /etc/sudoers
-r--r---w- 1 root root 755 Jan 18 2018 /etc/sudoers
ubuntu@azurevm:~$
ubuntu@azurevm-VM:~$
ubuntu@azurevm:~$
ubuntu@azurevm:~$ pkexec chmod 0755 /etc/sudoers
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/chmod' as the super user
Authenticating as: Ubuntu (ubuntu)
Password:
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized
This incident has been reported.
ubuntu@azurevm:~$ uname -a
Linux azurevm 4.18.0-1018-azure #18~18.04.1-Ubuntu SMP Tue May 7 18:09:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
whereas the authentication mode chosen while deploying VM was SSH-based. There are other ways to fix. Neither I couldn't reset the password for ubuntu nor the azure CLI is accessible.
Let me know how I can fix this or if you need further information on this.