LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Added user to Sudoers Not Working (https://www.linuxquestions.org/questions/linux-newbie-8/added-user-to-sudoers-not-working-4175608898/)

mattconverge 06-30-2017 07:06 AM

Added user to Sudoers Not Working
 
So I have added a new user to the sudoers file in the right place on CENTOS 6.9 and restarted too, when I SSH as the user it logs in but still says user is not in sudoers file when it blatantly is and also is a member of the wheel group too.

How do I fix this please, the user is there under root in the sudoers file with the same access levels.

Thanks
Matt

BhushanPathak 06-30-2017 07:25 AM

Can you post the entry made in the sudoers file here?

Habitual 06-30-2017 07:26 AM

Welcome to LQ Matt!

wrt:
Quote:

Originally Posted by mattconverge (Post 5729117)
So I have added a new user to the sudoers file in the right place

can you elaborate exactly how you did this operation? Any documentation you followed and perhaps the line
used in the edit as well?

Did the "sudoer" assigned log out and back in ?

Please let us know.

mattconverge 06-30-2017 07:31 AM

1 Attachment(s)
I followed this walkthrough

https://wiki.centos.org/TipsAndTricks/BecomingRoot

Attached is the image I added them directly to the sudoers file, saved and restarted to test.

wpeckham 06-30-2017 08:00 AM

Quote:

Originally Posted by mattconverge (Post 5729123)
I followed this walkthrough

https://wiki.centos.org/TipsAndTricks/BecomingRoot

Attached is the image I added them directly to the sudoers file, saved and restarted to test.

That document specifies something to add to sudoers, but not how to add it. You should be using "visudo" to make changes. Is that what you used?

Can you provide the results when your new user runs the command
Code:

sudo -l
where the option is a lower case L.

Thank you.

dejank 06-30-2017 08:05 AM

How about system15 instead of System15, if that is username to whom you want to give full sudo privs? You know that usernames should always be lower case?

BW-userx 06-30-2017 08:35 AM

wheel is still commented out in that image of the sudoers file post #4

# %wheel
should be
%wheel

Code:

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL
## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL

and the user added to the wheel group, log out log in to activate user if your in that same user under su modding the file.

you can use visudo if you know the commands to edit - save - exit or nano if you know what you are doing they both work to edit your sudoers file.

Any text editor actually, as long as root is using it so it can be saved. Just do not be adding or removing anything if you are not sure what you are doing else you may lock yourself out of your systems capabilities to run anything needing root - then its time for damage control.

which needs a separate means to gain entry into that system with root privileges to fix it.

you might want to back up your original file first before proceeding.
Code:

#cp -v sudoers sudoers.org
If by chance it is that

System15 ALL=(ALL) ALL

adding this to my system after creating that user it worked perfectly all I needed to do was use the password for same said user.
Code:

surooterdude ALL=(ALL) ALL
you might want to check to be sure the case for the username and the one in the sudoers file are exactly the same.

dejank 06-30-2017 08:57 AM

You do not need to add user to the wheel group, nor any other group to grant him full sudo privs, though it is sure better and more clean way of doing it. All you do need to give him full sudo privs is:

Code:

user_name  ALL=(ALL) ALL
line in sudoers file, or any file under /etc/sudoers.d/, as long as your sudoers file has #includedir /etc/sudoers.d directive in it. And all files under /etc/sudoers.d/ should have 0440 permission.

AwesomeMachine 07-01-2017 02:32 PM

A nice feature of visudo is that it checks syntax when you close it.


All times are GMT -5. The time now is 01:27 PM.