LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 04-28-2017, 01:23 AM   #1
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 85

Rep: Reputation: Disabled
sudoerswheel file overriding user settings in sudoers file


Hello,

I have a user named lfc added in /etc/sudoers file as follows -

Code:
Defaults    requiretty
Defaults:lfc !requiretty
lfc ALL=(ALL)       NOPASSWD: ALL

The lfc user was able to execute commands via sudo without being prompted for a password. Then I added a sudoerswheel file at /etc/sudoers.d/sudoerswheel, content as follows -

Code:
Defaults:admin    requiretty, timestamp_timeout=0
%wheel ALL=(ALL) ALL
I added this so that the admin user should be prompted for a password everytime the user executes a command via sudo.

The problem I'm observing is that now user lfc is also prompted for a password, which I don't want.

Any idea why this is happening? I cannot delete the sudoerswheel file as that was a recommendation from the security team.

If I add the settings for user lfc again in sudoerswheel file, then things return back to normal, but do I need to make the duplicate entry?

OS - CentOS 6.9 (Final)

Thanks
Bhushan Pathak
 
Old 04-28-2017, 01:40 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
Sudo parses all sudoer instructions in order, so that later instructions override earlier ones. From your post it seems that instructions in separate files in sudoers.d are processed last. Try commenting out the lfc instruction in the main sudoers file and just leave the one in the sudoers.d/wheel file.

Note for the future: when you specify in /etc/sudoers that files in /etc/sudoers.d are to be accessed, make sure that there is always a syntactically correct file in that directory. For example, if you decide at some point to delete your extra wheel file, edit /etc/sudoers first to comment out the line that looks for it. Otherwise it creates a syntax error and sudo will stop working altogether.
 
Old 04-28-2017, 02:09 AM   #3
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 85

Original Poster
Rep: Reputation: Disabled
I will try that out, but one more question that I have is that in the wheel file, I have added entry only for admin user. Why is it overriding settings for lfc user?
 
Old 04-28-2017, 05:39 AM   #4
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
Is lfc a member of the wheel group?
 
Old 04-28-2017, 06:16 AM   #5
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 85

Original Poster
Rep: Reputation: Disabled
No, lfc is not a member of wheel group, admin is.
 
Old 05-15-2017, 12:36 AM   #6
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 85

Original Poster
Rep: Reputation: Disabled
Any thing I need to try out?
 
  


Reply



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
[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] User is not in the sudoers file khinch Debian 5 03-28-2012 12:27 PM
'user' not in the sudoers file thomas2004ch Linux - Software 6 05-24-2011 10:20 AM
User not in the sudoers file ersek Linux - Newbie 10 06-09-2009 12:35 PM
how a user can be added to sudoers file. afaheem1988 Linux - Newbie 5 08-10-2008 07:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:50 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