SUDO: executing as {any but non-root user} won't work

This is a discussion on SUDO: executing as {any but non-root user} won't work within the Linux Security forums, part of the System Security and Security Related category; Hello, i want one user (menuadmin) to be able to execute some command as ANY user BUT NOT root (and ...


Go Back   Usenet Forums > System Security and Security Related > Linux Security

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-06-2006
freejazz13@gmail.com
 
Posts: n/a
Default SUDO: executing as {any but non-root user} won't work

Hello,
i want one user (menuadmin) to be able to execute some command as ANY
user BUT NOT root (and with no password)

this is my sudoers:
#
menuadmin ALL= ( !root ) NOPASSWD: /usr/bin/id
#

Logged as menuadmin, I keep being asked for a password when I type:
sudo -u joe /usr/bin/id

When i change "!root" to "joe'", everything works as expected.
the " ! " operator is allowed for users on the sudoers man page though.
I don't understand. Could someone help me and explain this behaviour ?
Thanks
Jerome

Reply With Quote
  #2 (permalink)  
Old 12-06-2006
freejazz13@gmail.com
 
Posts: n/a
Default Re: SUDO: executing as {any but non-root user} won't work

Update:I reply to my own message
it seems that using the following syntax
(ALL, ! root ) does the trick...

Reply With Quote
  #3 (permalink)  
Old 12-07-2006
Jeroen Geilman
 
Posts: n/a
Default Re: SUDO: executing as {any but non-root user} won't work

freejazz13@gmail.com wrote:

> Update:I reply to my own message
> it seems that using the following syntax
> (ALL, ! root ) does the trick...


That being the only correct syntax, yeah.
One wonders why you would want to prohibit root from sudo-ing anyway - you
cannot logically prohibit root from doing anything.


--
All your bits are belong to us.
Reply With Quote
  #4 (permalink)  
Old 12-07-2006
freejazz13@gmail.com
 
Posts: n/a
Default Re: SUDO: executing as {any but non-root user} won't work

You misunderstood (or i explained myself not clearly, sorry)
I dont want to prohibit root form executing, i want a certain user to
be able to execute a certain command AS any user, except root (ie thei
user can not become root while executing the comand)
J


Jeroen Geilman wrote:
> freejazz13@gmail.com wrote:
>
> > Update:I reply to my own message
> > it seems that using the following syntax
> > (ALL, ! root ) does the trick...

>
> That being the only correct syntax, yeah.
> One wonders why you would want to prohibit root from sudo-ing anyway - you
> cannot logically prohibit root from doing anything.
>
>
> --
> All your bits are belong to us.


Reply With Quote
  #5 (permalink)  
Old 12-07-2006
Jeroen Geilman
 
Posts: n/a
Default Re: SUDO: executing as {any but non-root user} won't work

freejazz13@gmail.com wrote:

> You misunderstood (or i explained myself not clearly, sorry)
> I dont want to prohibit root form executing, i want a certain user to
> be able to execute a certain command AS any user, except root (ie thei
> user can not become root while executing the comand)


A-HA!
Light dawns...

Sorry, my experience with sudo doesn't go that far.

--
All your bits are belong to us.
Reply With Quote
  #6 (permalink)  
Old 12-07-2006
Chris F.A. Johnson
 
Posts: n/a
Default Re: SUDO: executing as {any but non-root user} won't work

On 2006-12-07, freejazz13@gmail.com wrote:
>
> Jeroen Geilman wrote:
>> freejazz13@gmail.com wrote:
>>
>> > Update:I reply to my own message
>> > it seems that using the following syntax
>> > (ALL, ! root ) does the trick...

>>
>> That being the only correct syntax, yeah.
>> One wonders why you would want to prohibit root from sudo-ing anyway - you
>> cannot logically prohibit root from doing anything.


[please don't top post]

> You misunderstood (or i explained myself not clearly, sorry)
> I dont want to prohibit root form executing, i want a certain user to
> be able to execute a certain command AS any user, except root (ie thei
> user can not become root while executing the comand)


Write a wrapper, e.g.:

case $1 in
root) ;;
*) su - "$1" -c COMMAND ;;
esac

...and give the user the right to execute it in /etc/sudoers.

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:11 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0