I have been looking around on how to solve the issue of changing the permissions on the directory where the sudoers
file is located (in my case /etc/
).
This question points to the same problem, however the solution isn't feasible because you still need sudo priviliges which are not accessible.
However, if there were a way to access the session with root privileges, could I run chmod -R ugo+r /etc/
and get things back to normal? How can I login from a SSH (I'm using PuTTY), and get this back to normal?
I cannot currently reboot in safe mode, since it is a cloud server from a client and its out of my reach. It's an Ubuntu 16.04 LTS machine, and I could try to ask for the root credentials, although I have been reading that there are none (so I have no clue how to do 'login' as root...)
EDIT: Now I can't even connect with PuTTY... Please help!
EDIT2: after following the advice provided, here is the pkexec
authentication error after typing the correct password
soporteit@redacted:~$ pkexec chmod 555 /etc/sudoers
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/chmod' as the super user
Authenticating as: Soporte IT,,, (soporteit)
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.
soporteit@redacted:~$
EDIT2: so far it has been impossible to do this action from the shell. The machine keeps blocking our actions, and after the previous authentication error, it blocks our IP. Going to try to reboot the virtual machine using this tutorial and enter root
mode to modify the file permissions
pkexec
, notsudo
.pkexec
in the default ubuntu configuration requires the user to be a member of thesudo
group, but not that there be a validsudoers
. – user4556274 Jan 18 '18 at 19:54