You are not logged in.

#1 2021-04-13 01:30:41

webbja123
Member
Registered: 2021-03-31
Posts: 23

How can I re-add myself to the sudoers file [SOLVED]

I realized that I was not able to install certain packages without becoming the root user on my machine.  After a brief investigation I found that the command

wheel ALL=(ALL) ALL

lines in my /etc/sudoer file was not un-commented.  I used the visudo command and uncommented it in the vim editor.  However, after doing so it appears that I unadded my username from the file because now I cannot use the sudo command without getting the following error.

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

  How do I add my username back to the sudoers file? [SOLVED]

Last edited by webbja123 (2021-04-13 13:10:26)

Offline

#2 2021-04-13 01:57:35

GaKu999
Member
From: US/Eastern
Registered: 2020-06-21
Posts: 696

Re: How can I re-add myself to the sudoers file [SOLVED]

More exactly, you are not in the wheel group, you must add your user to the wheel group using usermod.

Something like:

# usermod -a -G wheel your_username_here

My reposSome snippets

Heisenberg might have been here.

Offline

#3 2021-04-13 03:00:52

webbja123
Member
Registered: 2021-03-31
Posts: 23

Re: How can I re-add myself to the sudoers file [SOLVED]

I already tried that and it did not fix the issue, which surprised me!

Offline

#4 2021-04-13 03:28:43

GaKu999
Member
From: US/Eastern
Registered: 2020-06-21
Posts: 696

Re: How can I re-add myself to the sudoers file [SOLVED]

Did you re-login?

Post output of the command groups and the contents of sudoers...


My reposSome snippets

Heisenberg might have been here.

Offline

#5 2021-04-13 06:46:48

seth
Member
Registered: 2012-09-03
Posts: 51,213

Re: How can I re-add myself to the sudoers file [SOLVED]

%wheel ALL=(ALL) ALL

However I'm not sure how the entire scenario adds up:

I was not able to install certain packages without becoming the root user

You're not able to install any packages w/o root permissions.

now I cannot use the sudo command without getting the following error

This seems to imply that the user previously was added to the sudoers and you could sudo - in which case even adding the wheel *group* (the "%") to the sudoers and yourself to the wheel group wouldn't have made any difference to begin with?

GaKu999 wrote:

Post … the contents of sudoers

Yes, please.
I think you "uncommented" the wheel group by removing the "%" (what turned the group into a user - not yours) but there's also a chance that you ran into this meme:
meme.jpeg

Offline

#6 2021-04-13 13:09:50

webbja123
Member
Registered: 2021-03-31
Posts: 23

Re: How can I re-add myself to the sudoers file [SOLVED]

That was the issue.  I accidentally deleted the % symbol with the # symbol in front of wheel.  Unfortunately that has revealed another issue, but I will create another post to describe that.  Thank you.

Offline

Board footer

Powered by FluxBB