I have just updated the software, which included replacing the sudoers file. Having noted the line in the file for myself, I expected to be able to edit it and put myself back.

I was wrong - it removed my sudo permissions, so I locked myself out.

How can I fix this problem?

I do have terminal access.

  • My version of nginx is wheezy which has that vulnerability fixed. Its also a VPS, so I can't boot off Live CD, but my ISP might help.
    – Ian
    Nov 19, 2016 at 11:34

1 Answer 1


Do you know your root password? If yes, than just login using root account and fix this issue. Also you could boot single-mode and fix this issue.

If it doesn't work, then other options available. Do you have nginx installed? If yes, there is vulnerability in nginx package at Ubuntu/Debian that will allow you to get root permissions.

No nginx? No problem, I guess you have some other packages installed which have vulnerabilities that could give your root permissions.
If nothing helps then boot your server from any LiveCD/LiveUSB, mount your original root partition and fix sudoers file.

  • @Ian may be you have root access? May be you know root password and can login on terminal or have root ssh key and you could try ssh -l root <server> ? This will be the easiest soultion. Also there are some alternatives to sudo like super installed even you don't know about that. Try commands from sudo.ws/other.html, may be you will be lucky. Also check google for "<Your vps provider> single mode" -- people often needs single mode for a lot of reasons and your VPS provider may have option to access it. Nov 19, 2016 at 12:19
  • @Ian also if your VPS supports cloud-init you could add more section to your vps' user-data clod-init configuration, reboot your server from Panel/Dashboard and have your sudoers fixed. Nov 19, 2016 at 13:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .