Skip navigation

Security API failed with error -60008

512 Views 2 Replies Latest reply: Jun 5, 2013 7:48 AM by Camelot RSS
John Antolino Level 3 Level 3 (530 points)
Currently Being Moderated
Jun 3, 2013 4:15 PM

Security API failed with error -60008

 

Hi all having an issue with apple script

 

specifically with the line

 

do shell script "sudo mdutil -i on /" with administrator privileges

 

------------------------------

In apple script I get an error

Security API failed with error -60008

but if I manully type it into terminal I get no errors. What am I doing wrong?

 

Thanks for any help

 

 

-----------------------

 

-- script starts here

 

set user_stuff to display dialog "This will re-index spotlight" buttons {"Go", "Cancel"}

set button_name to button returned of user_stuff

 

if button_name is "go" then

 

do shell script "sudo -v" password "" with administrator privileges

 

(display dialog "turning off index" buttons {""} giving up after 3)

do shell script "sudo mdutil -i off /" with administrator privileges

 

(display dialog "checking to see if index is off" buttons {""} giving up after 3)

do shell script "sudo mdutil -E /" with administrator privileges

 

(display dialog "removing spotlight index" buttons {""} giving up after 3)

do shell script "sudo rm -rf /.Spotlight-v100" with administrator privileges

 

(display dialog "removing index folder cache" buttons {""} giving up after 3)

do shell script "sudo rm -Rf /var/folders/*" with administrator privileges

 

(display dialog "restarting index process" buttons {""} giving up after 3)

do shell script "sudo mdutil -i on /" with administrator privileges

 

end if

 

 

set thedialog to display dialog "do you want to see spotlight index" buttons {"yes", "no"}

set buttonname to button returned of thedialog

 

if buttonname is "yes" then

 

tell application "Terminal"

quit

end tell

delay 1

tell application "Terminal"

activate

do script "sudo opensnoop -n mdworker"

end tell

end if

MacBook Pro, Mac OS X (10.7.3)
  • Bernard Harte Level 4 Level 4 (3,025 points)
    Currently Being Moderated
    Jun 5, 2013 7:16 AM (in response to John Antolino)

    I am pretty sure it's just because you are not escaping the path.

     

    The AppleScript version should read:

     

    do shell script "sudo mdutil -i on //" with administrator privileges

     

    I think, by the way, that having sudo and the 'with administrator privileges' is probably tautological - you really only need one or the other in my opinion.

  • Camelot Level 8 Level 8 (45,670 points)
    Currently Being Moderated
    Jun 5, 2013 7:48 AM (in response to John Antolino)

    do shell script "sudo mdutil -i on /" with administrator privileges


    Never, ever, ever use 'sudo' within 'do shell script'.

     

    At one level, sudo expects to prompt the user for authentication. You can't do that within 'do shell script'.
    If you need elevated privileges that's what '... with administrator privileges' is for.

     

    All of your commands should work if you remove the 'sudo'.

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.