[sudo-users] syntax error

LaComa, Lyn Lyn.LaComa at inova.org
Thu Jul 21 12:05:08 EDT 2011


Putting the #!/bin/ksh as the first line of the script fixed the
problem. 

Thanks for all the input.
After doing so many complex things, it's the simple ones that can bite
you!

 
Lyn LaComa
Sr.Systems Engineer
Inova Health System
lyn.lacoma at inova.org
703-889-2036

-----Original Message-----
From: Matthew Hannigan [mailto:mlh at zip.com.au] 
Sent: Thursday, July 21, 2011 1:46 AM
To: LaComa, Lyn
Cc: Paul Cantle; sudo-users at sudo.ws
Subject: Re: [sudo-users] syntax error


Your testing is probably with ksh but sudo maybe is using the old
/bin/sh or whatever the AIX equiv is.
It doesn't understand the $( ) syntax.

Try putting 
#!/bin/ksh 
as the first line of your shell scripts.
Or invoke directly with ksh


On Wed, Jul 20, 2011 at 06:31:16PM -0400, LaComa, Lyn wrote:
> 
> It is not a syntax issue, because root can execute the script. 
> 
> But I did change it to verify, still get the same error when doing
sudo
> from lawson id.  And root still works.
> 
> 
> Could there be something in the environmental variables that is
causing
> this?
>  
> Lyn LaComa
> 
> -----Original Message-----
> From: Paul Cantle [mailto:paul at cantle.me] 
> Sent: Wednesday, July 20, 2011 2:25 PM
> To: LaComa, Lyn; sudo-users at sudo.ws
> Subject: Re: [sudo-users] syntax error
> 
> Hi,
> 
> Try removing the space between the $( and the ps -ef statement.
> 
> It should be $(ps -ef, etc, etc)
> 
> This will be for all of your statements.
> 
> It doesn't look like a sudo issue to me, just syntax error within the
> script.
> 
> Try it out.
> 
> Paul
> 
> 
> 
> 
> 
> 
> On 20/07/2011 19:12, "LaComa, Lyn" <Lyn.LaComa at inova.org> wrote:
> 
> >Recently installed sudo 1.8.1p2 on AIX 6.1.0.0.
> >
> >Is working for original purpose of security user adding other users,
> >with specific commands specified in sudoers.
> >
> > 
> >
> >Problem with a runas_alias for a specific user (lawson)  to run a
> script
> >to start an application.
> >
> >Root can run the script with no problem, of course.
> >
> > 
> >
> >Part of  sudoers:
> >
> ># Run as alias specification
> >
> >Runas_Alias  LAW = root
> >
> > 
> >
> >lawson ALL = (LAW) NOPASSWD: /prod/scripts/lawstart.sh
> >
> >lawson ALL = (LAW) NOPASSWD: /prod/scripts/lawstop.sh
> >
> > 
> >
> >beginning of script setting up variables:
> >
> >$ more lawstop.sh
> >
> >## Sample Shut Down Script with Correct Order ##
> >
> >PATH=/opt/IBM/ldap/V6.2/sbin:/opt/IBM/ldap/V6.2/bin:$PATH
> >
> > 
> >
> ># Kill WebSphere DataStage RMI Server process
> >
> >PID=$( ps -ef | grep -v grep| grep rmiserver | awk '{print $2}')
> >
> >COMPID=$( ps -ef | grep -v grep | grep comsvr | awk '{print $2}')
> >
> >SMTPPID=$( ps -ef | grep -v grep | grep SmtpAgent | awk '{print $2}')
> >
> > 
> >
> > 
> >
> >Results when trying to execute via sudo:
> >
> >$ sudo -D 9 ./lawstop.sh
> >
> >sudo: settings: debug_level=9
> >
> >sudo: settings: progname=sudo
> >
> >sudo: settings: network_addrs=10.160.32.60/255.255.255.0
> >
> >sudo: sudo_mode 1
> >
> >sudo: policy plugin returns 1
> >
> >sudo: command info: umask=022
> >
> >sudo: command info: command=/prod/scripts/lawstop.sh
> >
> >sudo: command info: runas_uid=0
> >
> >sudo: command info: runas_gid=0
> >
> >sudo: command info: runas_groups=0,2,3,7,8,10,11,206,207,208
> >
> >sudo: command info: closefrom=3
> >
> >sudo: command info: set_utmp=true
> >
> >/prod/scripts/lawstop.sh: Syntax error at line 5: `PID=$' not
expected.
> >
> >sudo: received signal 20
> >
> >sudo: calling policy close with wait status
> >
> > 
> >
> > 
> >
> >any ideas?
> >
> > 
> >
> >____________________________________________________________
> >sudo-users mailing list <sudo-users at sudo.ws>
> >For list information, options, or to unsubscribe, visit:
> >http://www.sudo.ws/mailman/listinfo/sudo-users
> 
> 
> ____________________________________________________________
> sudo-users mailing list <sudo-users at sudo.ws>
> For list information, options, or to unsubscribe, visit:
> http://www.sudo.ws/mailman/listinfo/sudo-users




More information about the sudo-users mailing list