0

This question already has an answer here:

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!

marked as duplicate by steeldriver, muru, karel, Zanna, Pilot6 Jul 10 '17 at 9:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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 :

root@ubuntu:~#

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? – Rinaldo Jonathan Jul 13 '17 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 – Rubén Ruíz Oct 11 '18 at 21:16
0

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

    su
    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.