I am locked out on ubuntu after a recent update/upgrade. I have disabled remote root login to my VPS. I can access my VPS through SSH or via digitial ocean console but I am unable to issue 'sudo' command, on entering my password it says: "asad is not in the sudoers file. This incident will be reported."

closed as off-topic by muru, David Foerster, Zanna, Eric Carvalho, Mark Kirby Jan 9 '17 at 20:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – muru, David Foerster, Zanna, Mark Kirby
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    If you can't get into your VPS by ssh with sudo powers you should see if your provider offers VNC or emergency access or similar. Most do offer something along those lines which helps prevent total lockouts. – Thomas Ward Jan 8 '17 at 19:28
  • You can't su to root once you are logged on? – user4556274 Jan 8 '17 at 20:33
  • @ThomasWard I have ssh access to my VPS but i can't issue sudo commands on my VPS shell. for security reasons, I have disabled remote root acces, I have added my personal machines SSH keys to my remote VPS and its working fine. I have shell access on my VPS – asdi744 Jan 9 '17 at 5:24
  • @user4556274 I can't – asdi744 Jan 9 '17 at 5:24
  • 1
    issue resolved. i have rested root password from Digital Ocean Dashboard, got remote root access via root user and added myself to sudoers. – asdi744 Jan 9 '17 at 6:34

In Digital Ocean, if you have disabled root access via SSH and are locked out of your VPS, you can always access it from browser through "Console access" in control panel. DO control panel

You can rest your root password first if you don't remember and then use that to access your droplet.

  1. Log into your server with your user

  2. use su command and log in via root password.

  3. type usermod -aG sudo asad

you're done.

  • su doesn't work according to OP. – David Foerster Jan 9 '17 at 10:05
  • @DavidFoerster, what doesn't work is sudo, not su – Sadegh Alirezaie Jan 9 '17 at 23:38
  • Read the comments! Someone asks about su and OP replies that the root account is disabled. – David Foerster Jan 10 '17 at 9:24
  • @DavidFoerster it says "remote root login", so he can connect to his server with his nirmal user, and type in su, that's it. – Sadegh Alirezaie Jan 10 '17 at 10:52

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