0
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!

Zanna
  • 70,465
Don
  • 1

2 Answers2

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.

Zanna
  • 70,465
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.

Shlublu
  • 743