0

I tried to install something with sudo but I received: ".... is not in the sudoers file. this incident will be reported". I used "su -" and "su root" to fix this problem but I got "authentication failure". What should I do to fix this?

Retvik
  • 1
  • 2
    Does this answer your question? [How can I add a user as a new sudoer using the command line?](https://askubuntu.com/questions/7477/how-can-i-add-a-user-as-a-new-sudoer-using-the-command-line) – Simon Sudler Jul 24 '23 at 11:37
  • Unfortunately no. – Retvik Jul 24 '23 at 12:48
  • Find someone whose account has `sudo` privileges and have them add you to sudoers. Next alternative is to boot the system off of a live image and add yourself to sudoers. – doneal24 Jul 24 '23 at 13:03
  • Does this answer your question? [How do I add myself back as a sudo user?](https://askubuntu.com/questions/70442/how-do-i-add-myself-back-as-a-sudo-user) – karel Jul 30 '23 at 02:03
  • I solved it. First deleted ubuntu and installed again. Then with su root, added myself to the sudoer. Thank you to everybody that tried to help me :) – Retvik Jul 31 '23 at 09:28

1 Answers1

0

The user needs to be in the sudo group. Trying su and sudo root doesn't work because,for security reasons, Ubuntu has disabled the whole idea of a root password. You can manage your system easily with a properly configured sudo. Read man sudo sudoers.

If you don't have access to any UID 0 account, you'll have to reboot into "single user mode", adduser your_userid sudo, and reboot again. If you can't use adduser, read man groups, and, in single user mode, nano /etc/groups. Find the line beginning with sudo:, append your_userid to the the comma-separated userid list after the second colon. If your_userid is the only one, no comma is needed.

waltinator
  • 35,099
  • 19
  • 57
  • 93