Adding content to com.Apple.Safari.plist

Contributor II

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></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.



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/ <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 ""

${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.

Release Candidate Programs Tester

@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: