0

I installed a SSL certificated the day before. Today I wanted to log in to the server. When I try to "sudo" it gives me the following error message:

sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
[enter image description here][1]sudo: unable to initialize policy plugin

when I "su -" it ask me for a password. However I have never made one I think.

I can remember that I typed in during the ssl certificate configuration the following line of code. And nothing really happened. I wanted to remove the whole "Letencrypt" stuff. However I later fixed the issue so there was no need to remove it. Maybe this helps..

rm -rf /path/to/your/git/clone/directory
rm -rf ~/.local/share/letsencrypt
rm -rf /etc/letsencrypt
rm -rf /var/log/letsencrypt
rm -rf /var/lib/letsencrypt

How can I get back root access?

Thanks!

  • 1
    If the `sudoers` file isn't there then your only option is to put in a ticket with Amazon to do a recovery to restore the file which they won't make a very high priority if they even do it at all. The only thing that I can surmise is that you accidentally deleted or moved it but as you're not root, you can't use the `locate` command or examine the `bash_history` of root to be absolutely certain about what happened. – Nasir Riley Jun 12 '18 at 00:59
  • Thanks for your answer. so the only way is to set up a new instance? I found this link, would that work? http://asymmetrical-view.com/2012/11/07/fixing-sudoers-on-aws-ec2.html – Matthias Reichl Jun 12 '18 at 08:07
  • In that user's case, the `sudoers` file only had errors whereas yours is missing altogether. With that, the only option is to use a live disc or USB to put it back or do a recovery but again, you'd have to put in a ticket with Amazon. – Nasir Riley Jun 12 '18 at 11:52
  • Ok thank you for the help. Do you know how to open a ticket on Amazon? I also have a snapshot of the instance when it was working before. Does that help? – Matthias Reichl Jun 12 '18 at 13:37
  • Then can't you just restore the snapshot? If the `sudoers` file is in it then that will remedy your issue. – Nasir Riley Jun 12 '18 at 14:11
  • Thank you very much. I was able to fix everything by restoring the snapshot and reinstalled the SSL certificate. Saved me a lot of work. Wish you a great day! – Matthias Reichl Jun 22 '18 at 10:26

1 Answers1

0

Sounds like /etc/sudoers is hosed. If you don't know the root password then you could be SOL.

I would recommend reverting to a snapshot prior to making the change.

Keiran Holloway
  • 1,146
  • 6
  • 13