I installed ubuntu 18.04 on an AWS instance, and accessed it via a putty session as ubuntu (using the AWS generated key).

I wanted to allow password based login, and I modified the ssh_login and sshd_login to allow password based authentication.

Then I screwed up, and manually edited the /etc/sudoers files

sudo vi sudoers

and saved the file. I made a syntax error in sudoers. I am now stuck.

Yes, I should have used pkexec visudo, but I did not. Any idea how to fix this? This is a remote system, so I cannot reboot in debug mode, or use a USB to reboot.

  • These instructions might enable you to mount and edit /etc/sudoers in another instance. I'm a bit rushed, so I didn't verify that it can do that. – Chai T. Rex May 24 '18 at 23:06
  • Yes, this will work, but this is the only disk, and I freeze the instance, I will not be able to "re-attach" it, nothing to attach it to – EastsideDeveloper May 24 '18 at 23:08
  • "I should have used pkexec visudo" ... and you still can. – muru May 25 '18 at 1:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.