Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 12, 2013, 11:11 AM   #1
dezzeus
macrumors newbie
 
Join Date: Dec 2012
[Applescript] Security Framework issue

I was looking for running a shell command as root without asking the password to the user (except the first time), so I've decided to go through the Security Framework making a keychain to store and retrieve it in security but, as long as the Terminal prints the correct password:
Code:
password: "the_password"
doing the same from within Applescript, it returns me an empty string!
The code who give me that problem is:
Code:
set rootPassword to word 2 of (do shell script "security find-generic-password -gs \"my_service\" | tail -n 0")
Obviously, the keychain is made in order to allow the security command to access everything without asking for a password.

P.S.: I've tried to remove both the tail part and the word 2 of one in the Applescript code and it prints every line except the one that I need.

Last edited by dezzeus; Mar 12, 2013 at 01:36 PM.
dezzeus is offline   0 Reply With Quote
Old Mar 12, 2013, 01:37 PM   #2
dezzeus
Thread Starter
macrumors newbie
 
Join Date: Dec 2012
I've resolved using
Code:
set rootPassword to word 2 of (do shell script "security 2>&1 >/dev/null find-generic-password -gs \"my_service\"")
dezzeus is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Applescript moving files issue Liquid80 Mac Programming 2 Oct 2, 2013 11:29 PM
Security issue? DianeK Mac Basics and Help 4 Aug 30, 2013 11:10 PM
One last different AppleScript issue ring Mac Programming 3 Aug 7, 2013 09:20 PM
AppleScript cache issue? sswany Mac Programming 4 Oct 30, 2012 06:54 PM
Applescript Entourage Attachment compression issue nicoboss Mac Programming 1 Aug 9, 2012 02:10 PM

Forum Jump

All times are GMT -5. The time now is 03:54 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC