Posted on 05-16-2014 02:26 AM
Hi. I need to add a bunch of stuff to a Users Safari PLIST file.
In the end I need to add the following to the PLIST but be unsure if, and how I could/should use defaults write command for this. Maybe somebody can help me out?
This is what finally need to be added to the file:
<key>PlugInHostnamePolicies</key> <array> <dict> <key>PlugInHostname</key> <string>some.domain.com</string> <key>PlugInLastVisitedDate</key> <date>2014-05-16T09:08:32Z</date> <key>PlugInPageURL</key> <string>complete string URL</string> <key>PlugInPolicy</key> <string>PlugInPolicyAllowWithSecurityRestrictions</string> <key>PlugInRunUnsandboxed</key> <false/> </dict> </array>
Thanks a lot for your help.
Posted on 05-16-2014 04:14 AM
Hi there I don't know the special keys you have listed, but to write into a users plist file via `/usr/bin/defaults` you need to be the user. You could do something like sudo -u ${LOGIN} defaults write /Users/${LOGIN}/Library/Preferences/com.apple.safari.plist <key> <datatype> "<value>"
Where <key> e.g. would be PlugInHostnamePolicies <datatype> would be -string and <value> would be whatever is inside the string field, here "some.domain.com"
${LOGIN} is a defined variable I use for the logged in user, but with JAMF you also should be able to use $3.
Hope that helps.
Posted on 05-16-2014 06:41 AM
@maik.sanftenberg, the issue is the nested dict's
Defaults is not great with that, so you'll need to go to plistbuddy or python to manipulate.
BUT these settings can be managed via a config profile as per: http://support.apple.com/kb/HT6168