Deploying Chrome Prefs

ChrisTech
Contributor

Hey Guys..

I'm having difficulty with Chrome prefs. I have the requirement of several local accounts that need to open with Chrome to a specific website for each account. I created the local accounts with the same UID so the prefs work for macOS stuff, but Chrome always freaks out and says the files have been corrupted and deletes/resets it's prefs. It's probably a security thing but I'm looking for answers.

I tried to just grab the entire ~/Library/Application Support/Google/ folder and that doesn't work either. Tried packaging the Preferences file and does not work either. All of the files have the correct owner/group.

6 REPLIES 6

Look
Valued Contributor III

Depending on what your trying to do there may be a few ways to do this.
If you just want a single URL opened on login you could just have a script in a login policy to open that URL in Chrome directly.
If your trying to set the default home page and other preferences you may do better with either a Configuration Profile with custom settings (scoped by user).
If you don't mind controlling Chrome for all users you could look into Chrome Master Preferences.

ChrisTech
Contributor

But.. it's a local account not a network account so the Config Profiles for user level won't work correct? Chrome Master Prefs would work if they all wanted the same page. I might try the login script. I do a script on login for dockutil to reset the dock on each login in case the student has messed with it.

Look
Valued Contributor III

This is my current open URL on login script, it takes the first JSS parameter ($4) and tells the Finder to open it using the default browser., this generally happens about 10 seconds after you hit the desktop. I would think you can just modify the last osascript part to tell it use Chrome specifically.
You should be able to then create a seperate policy for each URL you want and scope it to the appropriate users.

#!/bin/bash
The_URL="$4"
(
RunCount=0
Limit=30
Current_User="NONE_NADA_ZIP"
while [[ -z "$(ps -c -u $Current_User | awk /Finder/)" ]]  && [[ "$RunCount" -lt "$Limit" ]]; do
let RunCount=$RunCount+1
sleep 2
Current_User=$(stat -f%Su /dev/console)
done
if [ "$The_URL" ] && [ "$(ps -ax -u $Current_User | awk '/Finder/ && !/awk/')" ]; then
sleep 1
/usr/bin/osascript<<END
tell application "Finder"
open location "$The_URL"
end tell
END
fi 
) &

ChrisTech
Contributor

What I ended up doing is a Chrome Master Preferences file in ~/Library/Application Support/Google/Chrome/ like this:

{
    "homepage": "http://yourURLhere.com",
    "homepage_is_newtabpage": false,
    "browser": {
        "show_home_button": true,
        "check_default_browser": false
    },
    "session": {
        "restore_on_startup": 4,
        "startup_urls": [
            "https://yourURLhere.com"
        ]
    },
    "distribution": {
        "show_welcome_page": false,
        "skip_first_run_ui": true,
        "import_history": false,
        "import_bookmarks": false,
        "import_home_page": false,
        "import_search_engine": false,
        "suppress_first_run_bubble": true,
        "suppress_first_run_default_browser_prompt": true
    },
    "sync_promo": {
        "user_skipped" : true
    },
    "first_run_tabs": [
        "http://yourURLhere.com"
    ]
}

The Google folder has to be empty except for the preferences file located in the Chrome folder. Doesn't work 100% but it's better than it was before.

Look
Valued Contributor III

Ahh per user master preferences, yes I guess the issue would be it needs to be populated after the user folder is created but before Chrome is opened for the first time.
How are you managing the per user part? are you populating it with a script or something?

ChrisTech
Contributor

I did create a script to delete the account (if it exists) and create a fresh account then lay the Google Chrome Master Preferences file down in the correct folder structure. Works great.. except for flash I am working on a Config Profile for that.