Skip to main content
Question

Adding keychain entry script errors

  • March 29, 2017
  • 1 reply
  • 0 views

Forum|alt.badge.img+4

I have created a script reading bits on here and man pages but can't get it working.

There are 2 scripts. one is for login keychain the other System.

Both error: Script result: /Library/Application Support/JAMF/tmp/TM Server Auth login: line 3: unexpected EOF while looking for matching `"'<br/>/Library/Application Support/JAMF/tmp/TM Server Auth login: line 6: syntax error: unexpected end of file<br/>

#!/bin/sh

sudo security add-internet-password -l "Time Machine 70” -a "TMUser" -w "********" -D "network password" -r "afp " -s "TimeMachine._afpovertcp._tcp.local./Time Machine Back Up" -T "/System/Library/CoreServices/NetAuthAgent.app/Contents/MacOS/NetAuthSysAgent" -T "/System/Library/CoreServices/NetAuthAgent.app" -T "/System/Library/PrivateFrameworks/SystemAdministration.framework/XPCServices/writeconfig.xpc"

exit
#!/bin/sh
security add-internet-password -l "Time Machine 70” -a "TMUser" -w "*********" -D “Time Machine Password" -r "afp " -s "TimeMachine._afpovertcp._tcp.local./Time Machine Back Up" -T "/System/Library/CoreServices/NetAuthAgent.app/Contents/MacOS/NetAuthSysAgent" -T "/System/Library/CoreServices/NetAuthAgent.app" -T "/System/Library/PrivateFrameworks/SystemAdministration.framework/XPCServices/writeconfig.xpc" /Library/Keychains/system.keychain
exit

If i drop "#!/bin/sh" and "exit" it runs within terminal without any errors and adds the entry exactly as i want.

help... :)

Thanks.

1 reply

Forum|alt.badge.img+16
  • Valued Contributor
  • 277 replies
  • March 29, 2017

You have a few smart quotes in there. TextEdit (and some other apps) replace straight "" characters with “” in an attempt to be helpful, but that can cause issues in scripts.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings