LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-17-2012, 08:06 PM   #1
laredotornado
Member
 
Registered: Apr 2011
Posts: 71

Rep: Reputation: 0
Are boolean expressions supported in /etc/sudoers file?


Hi,

I'm using CentOS. In my CentOS /etc/sudoers file, I want to specify that tty is required for everything except a couple of commands, which I've defined as ...

Code:
Cmnd_Alias      CPCMD = /bin/cp /var/lib/jenkins/jobs/My\ Client/workspace/target/myclient*.war /usr/java/jboss/server/default/deploy
Cmnd_Alias     RMCMD = /bin/rm /usr/java/jboss/server/default/deploy/myclient*.war
How do I say I don't want these two commands to require tty? I've tried ...

Code:
Defaults       !CPCMD  requiretty
Defaults       !RMCMD  requiretty
but that doesn't work. I'm thinking some kind of boolean expression of the above is required, but not sure the proper way to write it.

Thanks, - Dave
 
Old 09-18-2012, 04:47 AM   #2
segmentation_fault
Member
 
Registered: Sep 2008
Location: Ioannina, Greece
Distribution: Gentoo
Posts: 332

Rep: Reputation: 55
I am quoting from http://www.gratisoft.us/sudo/man/1.7.6/sudoers.man.html

BNF-like definition for defaults override:
Quote:
Default_Type ::= 'Defaults' |
'Defaults' '@' Host_List |
'Defaults' ':' User_List |
'Defaults' '!' Cmnd_List |
'Defaults' '>' Runas_List
Default_Entry ::= Default_Type Parameter_List
Parameter_List ::= Parameter |
Parameter ',' Parameter_List
Parameter ::= Parameter '=' Value |
Parameter '+=' Value |
Parameter '-=' Value |
'!'* Parameter
An example:
Quote:
Lastly, we disable shell escapes for the commands in the PAGERS Cmnd_Alias (/usr/bin/more, /usr/bin/pg and /usr/bin/less).

Defaults syslog=auth
Defaults>root !set_logname
Defaults:FULLTIMERS !lecture
Defaults:millert !authenticate
Defaults@SERVERS log_year, logfile=/var/log/sudo.log
Defaults!PAGERS noexec
So I guess in your case you are asking for tty. You are doing the opposite, but I may be wrong. I am a sudo noob
 
Old 09-18-2012, 08:24 AM   #3
laredotornado
Member
 
Registered: Apr 2011
Posts: 71

Original Poster
Rep: Reputation: 0
Right, I am asking for tty for everything except two commands. However, given the documentation, how do I combine my two command alias' to form a Cmnd_List ? - 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 On
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
Fedora /etc/sudoers file and sudoers.d directory davejjj Linux - Newbie 2 10-21-2011 06:19 PM
[SOLVED] sudoers and regular expressions starmonche Linux - General 4 08-02-2009 04:39 PM
editing expressions within a file DjRakso Linux - Newbie 1 05-09-2008 10:59 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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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