Mailinglist Archive: opensuse (1468 mails)

< Previous Next >
Re: [opensuse] Need help
  • From: "Boyd Stephen Smith Jr." <bss@xxxxxxxxxxxxxxxxx>
  • Date: Wed, 3 Jun 2009 14:00:16 -0500
  • Message-id: <200906031400.16906.bss@xxxxxxxxxxxxxxxxx>
In <630b55a80906031143k62e7f6bv88ed01c0877c1181@xxxxxxxxxxxxxx>, Chuck Payne
wrote:
On Wed, Jun 3, 2009 at 2:13 PM, Boyd Stephen Smith Jr.
<bss@xxxxxxxxxxxxxxxxx> wrote:
In <4A26CBE0.23F4.0029.1@xxxxxxxxxxxxx>, Dominique Leuenberger wrote:
On 6/3/2009 at 7:05 PM, Chuck Payne <terrorpup@xxxxxxxxx> wrote:
I need to write a script that gives one use access to stop and start
apache, I don't want to give them sudo.
For your usecase, sudo might actually be
the good way to go.
I agree. You don't want to give the user access to all commands, just a
few. So, you should add something like:
APACHE_CTL = /sbin/service apache2 *
APACHE_ADM = username

APACHE_ADM ALL=NOPASSWD: APACHE_CTL
to your /etc/sudoers, by using the visudo command.
Well, I am getting error when I add this to visudo

###################################
# Cmnd_Alias section #
###################################
APACHE_CTL=/usr/local/bin/apache.sh
APACHE_ADM=vgnadmin
###################################
# User Section #
###################################
APACHE_ADM ALL=NOPASSWD:APACHE_CTL
root ALL=(ALL) ALL
%sysadmin ALL=(ALL) ALL

The error is this...

visudo
Warning: undeclared User_Alias `APACHE_CTL' referenced near line 7
Warning: undeclared User_Alias `APACHE_ADM' referenced near line 8
Warning: undeclared User_Alias `APACHE_ADM' referenced near line 12
Warning: undeclared Cmnd_Alias `APACHE_CTL' referenced near line 12

Any clues what I am doing wrong?

Heh, taking my unvarnished advice. :P

I'm glad you used visudo, since I messed up the syntax. I think the command
alias line actually needs to be:
Cmnd_Alias APACHE_CTL = /usr/local/bin/apache.sh
and the user alias actually needs to be:
User_Alias APACHE_ADM = vgnadmin
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss@xxxxxxxxxxxxxxxxx ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/

< Previous Next >