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 0:59
  • Thanks for your answer. so the only way is to set up a new instance? I found this link, would that work? asymmetrical-view.com/2012/11/07/fixing-sudoers-on-aws-ec2.html – Matthias Reichl Jun 12 '18 at 8: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
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.