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 02-01-2010, 02:48 PM   #1
dthacker
Member
 
Registered: Nov 2003
Location: Omaha, NE
Distribution: Ubuntu, Kubuntu, Ubuntu Server
Posts: 77

Rep: Reputation: 15
/etc/sudoers syntax problems with %groupname


My goal: I want to give users in the group "rtkprd" the ability to elevate their privileges and run a restricted shell script by using sudo. The full path to the shell script is /usr/local/bin/only_rtkprd.sh
The syntax of /etc/sudoers is giving me fits, to I've reduced my sudoers to a single log directive and a single line to enable the rtkprd group.

Code:
Defaults logfile=/var/log/sudo

%rtkprd ALL = (rtkprd)          /usr/local/bin/only_rtkprd.sh
I'm a member of group rtkprd, here's my test:
Code:
/home/dthacker> id
uid=516(thackerd) gid=1(staff) groups=206(rtkprd)
When I attempt to run the script I get the "nag" screen and then this error:

Code:
Sorry, user thackerd is not allowed to execute '/usr/local/bin/only_rtkprd.sh' as root on rtkdev.mydomain.local.
I'm not sure what's wrong in the syntax, and I don't understand why sudo thinks I'm trying to run as root.

Please give me some pointers!
Thanks in Advance
Dave
 
Old 02-01-2010, 03:48 PM   #2
ofaring
Member
 
Registered: Feb 2006
Location: Ontario, Canada
Distribution: Debian, sometimes BSD.
Posts: 44
Blog Entries: 13

Rep: Reputation: 21
Hey,

Sudo is a means of granting root privileges. So when a command fails, it tells you that you aren't allowed to have root access to the command, because that is exactly what a properly configured /etc/sudoers file will give you. I believe that with the way your file is setup, you are trying to run root commands except with the permissions of group rtkprd. That's not going to work.

Here are some snippets from my Debian sudoers file.

Code:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults        env_reset

# User privilege specification
root    ALL=(ALL) ALL

# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL
%operator ALL=(root) NOPASSWD: /sbin/ifup
%operator ALL=(root) NOPASSWD: /sbin/ifdown
Hope that helps.

Last edited by ofaring; 02-01-2010 at 03:49 PM.
 
Old 02-01-2010, 10:21 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Quote:
%rtkprd ALL = (rtkprd) /usr/local/bin/only_rtkprd.sh
This '(rtkprd)' means you authorise the user to run the prog as the rtkprd user.


EG:
Quote:
steve CSNETS = (operator) /usr/local/op_commands/

The user steve may run any command in the directory /usr/local/op_commands/ but only as user operator.
http://linux.die.net/man/5/sudoers
 
Old 02-02-2010, 10:47 AM   #4
dthacker
Member
 
Registered: Nov 2003
Location: Omaha, NE
Distribution: Ubuntu, Kubuntu, Ubuntu Server
Posts: 77

Original Poster
Rep: Reputation: 15
My problem was not calling the user out.
Code:
sudo -u rtkprd /usr/local/bin/only_rtkprd.sh
That did the trick. Thanks to both of you for getting me on the right track.

Dave
 
  


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
Sudoers syntax clarification. uncle-c Linux - Newbie 3 11-11-2007 11:54 AM
Syntax error in sudoers file Julix Linux - General 9 09-07-2007 09:44 PM
sudoers and guarddog problems A89ion Linux - Newbie 4 07-28-2007 08:22 AM
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
sudo and sudoers syntax mikemrh9 Linux - Security 7 06-04-2005 07:54 PM

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

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