I am in a really bad condition right now.I am jotting down the steps I did to get myself into this situation.
My objective was to disable sudo
on my machine.
I am running Amazon Ec2 Ubuntu 12.04
I used this command to create a root password.
sudo passwd
At this moment I was 'ubuntu' user.
I edited my
/etc/sudoers
file using nano and did the following.#ubuntu ALL=(ALL) NOPASSWD:ALL----This enabled no password ubuntu ALL=(ALL) ALL---this enables password
So my file looked like (before I exited)
#ubuntu ALL=(ALL) NOPASSWD:ALL #ubuntu ALL=(ALL) NOPASSWD:ALL----This enabled no password ubuntu ALL=(ALL) ALL---this enables password
Now when I use the sudo
command I get the following error which is obvious as I messed up the file:
ubuntu@ip-10-144-143-249:~$ sudo
sudo: >>> /etc/sudoers.d/90-cloudimg-ubuntu: syntax error near line 4 <<<
sudo: parse error in /etc/sudoers.d/90-cloudimg-ubuntu near line 4
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
But when I use these commands su
,su root
, it asks me for password which I setup in Step 1.
But every time I put the password in I get an authentication failure message despite being 100% sure I am giving the correct password:
ubuntu@ip-10-144-143-249:~$ su
Password:
su: Authentication failure
I don't know what to do know.I checked for few solutions over the web and one of the way suggested to detach and reattach the volume.This can be done but as this is a production environment a lot of problem would arise. Is there a way/hack which can be done so that I can get the sudo operations working??