How to add myself back into sudoers in Ubuntu 14.04?

0

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.

Ian

Posted 2016-11-19T11:19:32.577

Reputation: 171

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 – 2016-11-19T11:34:18.670

Answers

3

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.

Fedor Dikarev

Posted 2016-11-19T11:19:32.577

Reputation: 244

@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 https://www.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.

– Fedor Dikarev – 2016-11-19T12:19:27.247

@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. – Fedor Dikarev – 2016-11-19T13:01:16.367