LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-20-2024, 06:03 AM   #1
HTop
Member
 
Registered: Mar 2019
Posts: 44

Rep: Reputation: Disabled
User is not in the sudoers file. This incident will be reported.


Hello,
I use RHEL 8.9 update today.
I joined my Active Directory domain animals.internal with realm join.
I permitted users of group koalas@animals.internal to log on through SSH.

Then the user pete (member of koalas) is able to log on on RHEL server.

I created a file called /etc/sudoers.d/animals.internal with the following text:

%koalas@animals.internal ALL=(ALL) NOPASSWD:ALL

But when pete runs "sudo su -", he gets
pete@animals.internal is not in the sudoers file. This incident will be reported.

I checked the syntax and it's ok.

visudo -c /etc/sudoers.d/animals.internal
/etc/sudoers.d/animals.internal: parsed OK


If I move the line %koalas@animals.internal ALL=(ALL) NOPASSWD:ALl on /etc/sudoers file, it works.

/etc/sudoers last line is
#includerdir /etc/sudoers.d/

The command ls -la /etc/sudoers.d/animals.internal
returns -r--r-----
Selinux is disabled.

What did I do wrong?

Sudo version is 1.9.5p2
 
Old 03-20-2024, 06:59 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,152

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
You need to uncomment this line:
Code:
#includerdir /etc/sudoers.d/
otherwise it wont be run.
 
Old 03-20-2024, 07:35 AM   #3
HTop
Member
 
Registered: Mar 2019
Posts: 44

Original Poster
Rep: Reputation: Disabled
Reading the man of sudoers, lines is that start with # are comments unless the # is immediately followed by either include or includedir.
 
Old 03-20-2024, 07:43 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,901

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
in that case I think the permissions on that file is not accepted by sudo. Or something similar happened.
by the way sudo and su should not be used together (but it is another issue).
 
Old 03-20-2024, 08:05 AM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
Quote:
Originally Posted by HTop View Post
/etc/sudoers last line is
#includerdir /etc/sudoers.d/
That should be "#includedir", not "#includerdir".

The misspelling makes that line a comment, and thus no syntax error found.
 
Old 03-20-2024, 03:32 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Isn't there some issue with ssh access on this?? I forget.
 
Old 03-20-2024, 04:01 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,665
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
That seems like a "lazy hack" on the part of the original programmer in question. Why not use another preceding character, like '$'? Oh well, water under the bridge now.
 
Old 03-20-2024, 04:16 PM   #8
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by sundialsvcs View Post
That seems like a "lazy hack" on the part of the original programmer in question. Why not use another preceding character, like '$'? Oh well, water under the bridge now.
You say "lazy hack." I say it's just dumb. I wonder what possessed that developer? <sigh>
 
Old 03-20-2024, 06:03 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
One site said they used new @
 
Old 03-20-2024, 06:11 PM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
Quote:
Originally Posted by scasey View Post
You say "lazy hack." I say it's just dumb. I wonder what possessed that developer? <sigh>
I suspect that it's just because "#include" is common in many other languages, and the programmer just got too used to typing it.
 
Old 03-21-2024, 02:19 AM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,901

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
Quote:
Originally Posted by scasey View Post
You say "lazy hack." I say it's just dumb. I wonder what possessed that developer? <sigh>
yes, it is an extremely "inconvenient" construct, but perfect if you just want to get a rise out of the user
 
Old 03-25-2024, 09:00 AM   #12
HTop
Member
 
Registered: Mar 2019
Posts: 44

Original Poster
Rep: Reputation: Disabled
In the file I keep the original line
#includedir /etc/sudoers.d/
I wrote here as "#includerdir /etc/sudoers.d/" but it's "#includedir /etc/sudoers.d/" indeed.

Maybe I'll do some syscall tracking to address this strange behavior.
 
  


Reply

Tags
rhel, sudo, sudoers



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] Admin is not allowed to run sudo on localhost. This incident will be reported. nitsss Linux - Newbie 14 12-29-2015 09:52 PM
Why am I getting student08 is not in the sudoers file. This incident will be reporte westerfield Linux - Newbie 20 04-17-2013 10:41 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
Fedora /etc/sudoers file and sudoers.d directory davejjj Linux - Newbie 2 10-21-2011 06:19 PM
I deleted /etc/sudoers and creates a new file call sudoers but now it doesnt for visu abefroman Linux - Software 1 11-10-2005 05:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:50 AM.

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