LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-30-2017, 07:06 AM   #1
mattconverge
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Rep: Reputation: Disabled
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
 
Old 06-30-2017, 07:25 AM   #2
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 85

Rep: Reputation: Disabled
Can you post the entry made in the sudoers file here?
 
Old 06-30-2017, 07:26 AM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Welcome to LQ Matt!

wrt:
Quote:
Originally Posted by mattconverge View Post
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.
 
Old 06-30-2017, 07:31 AM   #4
mattconverge
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
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.
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	374
Size:	16.4 KB
ID:	25359  
 
Old 06-30-2017, 08:00 AM   #5
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,907

Rep: Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816
Quote:
Originally Posted by mattconverge View Post
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.
 
Old 06-30-2017, 08:05 AM   #6
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
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?
 
Old 06-30-2017, 08:35 AM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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.

Last edited by BW-userx; 06-30-2017 at 09:00 AM.
 
Old 06-30-2017, 08:57 AM   #8
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
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.
 
Old 07-01-2017, 02:32 PM   #9
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
A nice feature of visudo is that it checks syntax when you close it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Configure sudoers in CentOS 5.10 for a user to run a script owned by another user as that user ripelivejam Linux - Newbie 2 12-22-2015 02:02 PM
[SOLVED] User not in sudoers: How to add user? Permtion Denied for sudoers file esgol Linux - Newbie 3 07-13-2012 07:44 AM
[SOLVED] I added a new user to the Linux server and can't logon as the user reinecke53 Linux - Newbie 10 03-27-2012 03:16 PM
how a user can be added to sudoers file. afaheem1988 Linux - Newbie 5 08-10-2008 07:15 PM
How to automatically add smb user when unix user added Winanjaya Linux - Newbie 3 01-07-2007 11:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration