ana is not in the sudoers file.  This incident will be reported.

So, what can I do?

To change the password I need to edit the sudoers file, and to edit the file I need the password!


2 Answers 2


Combining the comment from @steeldriver and this thread.

You need to use recovery mode from Ubuntu.

First, you have to hold shift when booting. You will be seeing this menu. Then select a menu with (recovery mode) in it. Preferred the 2nd from top.

enter image description here

Then, you should see this menu. Choose root. enter image description here

After that, you'll see a root prompt, something like this :


You see, using recovery will get you in read-only state. You need to make your system read write with this command.

mount -o rw,remount /

Then, you can readd your user to sudo with this command.

adduser YOUR_USERNAME sudo

Reboot as usual and you'll be able to use sudo.

  • why a freaking downvote? Jul 13, 2017 at 13:38
  • you can execute that command on simple terminal if you are inside postgres user account type "exit", on other user type that command: SUDO adduser postgres sudo Oct 11, 2018 at 21:16

As I get your question, Ana wishes to use sudo without being allowed yet. This requires root rights to be changed (fortunately!). I also understand you are root, and you are possibly ana.

Should my understanding be right:

  • Ana can do this if he/she has the root password

    adduser ana sudo

  • Or you can do this for Ana if you are root or sudoer but not him/her

    sudo adduser ana sudo

su switches to root, and therefore requires knowing the root password, and adduser ana sudo adds ana to the sudo group.

And should my understanding of your question be wrong, 1) sorry and 2) please let me know and I'll delete that answer.

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