Each of the browsers are different unfortunately.
Chrome can be managed via a custom config profile, Safari used to be able to, although some people have said it isn't working any longer, and firefox needs a custom setting added to the app bundle with CCK2.
Here's some useful guides / links:
For Safari
! /bin/bash
Get the UUID of the Mac system
if [[ ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-50
== "00000000-0000-1000-8000-" ]]; then
MAC_UUID=ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c51-62 | awk {'print tolower()'}
elif [[ ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-50
!= "00000000-0000-1000-8000-" ]]; then
MAC_UUID=ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62
fi
Kill open browsers
sudo killall -z -m "Safari" -signal
Get the list of local Users
localUsers=$( dscl . list /Users UniqueID | awk '$2 >= 501 {print $1}' | grep -v admin )
User Template
defaults write /System/Library/User Template/English.lproj/Library/Preferences/com.apple.Safari.plist HomePage https://apolloedu.sharepoint.com/sites/PhoenixView/
Delete keychain entry locking Safari HomePage
echo "$localUsers" | while read userName; do
mv /Users/$userName/Library/Keychains/$MAC_UUID/keychain-2.db /Users/$userName/Library/Keychains/$MAC_UUID/keychain-2.dbBKUP 2> /dev/null
defaults write /Users/$userName/Library/Preferences/com.apple.Safari.plist HomePage https://apolloedu.sharepoint.com/sites/PhoenixView/
defaults write /Users/$userName/Library/Safari/LastSession.plist TabURL https://apolloedu.sharepoint.com/sites/PhoenixView/
chown $userName /Users/$userName/Library/Preferences/com.apple.Safari.plist
sleep 3
mv /Users/$userName/Library/Safari/LastSession.plist /Users/$userName/Library/Safari/LastSession.plistBKUP
chmod 644 /Users/$userName/Library/Safari/LastSession.plistBKUP
chown -R $userName:"APOLLOGROUPDomain Users" /Users/$userName/Library/Safari/LastSession.plistBKUP
done
For Firefox
! /bin/bash
Kill open browsers
sudo killall Firefox.app
Get the list of local Users
localUsers=$( dscl . list /Users UniqueID | awk '$2 >= 501 {print $1}' | grep -v admin )
ffold=(http://arc.apollogrp.edu)
ffnew=(https://apolloedu.sharepoint.com/sites/PhoenixView)
User Template
sed -i .bak 's|'$ffold'|'$ffnew'|g' /usr/local/storage/Firefox/Profiles/lsbasfxf.default/prefs.js
sed -i .bak 's|'$ffold'|'$ffnew'|g' /System/Library/User Template/English.lproj/Library/Application Support/Firefox/Profiles/lsbasfxf.default/prefs.js
Existing Users
echo "$localUsers" | while read userName; do
sed -i .bak 's|'$ffold'|'$ffnew'|g' /Users/$userName/Library/Application Support/Firefox/Profiles/lsbasfxf.default/prefs.js
done
For Chrome
! /bin/bash
Kill open browsers
sudo killall -z -m "Google Chrome"
Get the list of local Users
localUsers=$( dscl . list /Users UniqueID | awk '$2 >= 501 {print $1}' | grep -v admin )
ffold=(http://arc.apollogrp.edu)
ffnew=(https://apolloedu.sharepoint.com/sites/PhoenixView)
User Template
defaults write /System/Library/User Template/English.lproj/Library/Preferences/com.google.Chrome.plist HomepageLocation -string https://apolloedu.sharepoint.com/sites/PhoenixView/
defaults write /System/Library/User Template/English.lproj/Library/Preferences/com.google.Chrome.plist RestoreOnStartupURLs -array https://apolloedu.sharepoint.com/sites/PhoenixView/
sed -i .bak 's|'$ffold'|'$ffnew'|g' /System/Library/User Template/English.lproj/Library/Application Support/Google/Chrome/Default/Preferences
Existing Users
echo "$localUsers" | while read userName; do
sed -i .bak 's|'$ffold'|'$ffnew'|g' /Users/$userName/Library/Application Support/Google/Chrome/Default/Preferences
defaults write /Users/$userName/Library/Preferences/com.google.Chrome.plist HomepageLocation -string https://apolloedu.sharepoint.com/sites/PhoenixView/
defaults write /Users/$userName/Library/Preferences/com.google.Chrome.plist RestoreOnStartupURLs -array https://apolloedu.sharepoint.com/sites/PhoenixView/
chmod 755 /Users/$userName/Library/Preferences/com.google.Chrome.plist
chmod 755 /Users/$userName/Library/Preferences/com.google.Keystone.Agent.plist
sleep 2
chown $userName:wheel /Users/$userName/Library/Preferences/com.google.Chrome.plist
chown $userName:wheel /Users/$userName/Library/Preferences/com.google.Keystone.Agent.plist
Remove HonePage MCX setting
dscl . -mcxdelete /Computers/localhost com.google.Chrome
mcxrefresh -n $userName
done
Thank you for your responses! I'm hoping to try these later today - I apologize for the delay in responding - got pulled into a different project temporarily.
@jkarpenske did you get a chance to try this if so what were your results? I tried to run parts of the script manually before setting a script in jamf and didn't have success setting the homepage.
The jamf Binary also has a Build in Option to set the Homepage for Safari and Firefox
Usage: jamf setHomePage -homepage <homepage> [-feu] [-fut] [-username <username>]
[-removeDownloadLocation] [-skipIE] [-skipFirefox] [-skipMozilla] [-skipSafari]
-homepage The URL for the homepage
-feu Set the homepage for existing users
-fut Set the homepage in the User Templates
-username Set the homepage only for this user
-ffmstone Specify the milestone version for FireFox
-mozmstone Specify the milestone version for Mozilla (Netscape)
-removeDownloadLocation Remove the default download location
-skipIE Do not set the homepage for Internet Explorer
-skipFirefox Do not set the homepage for Firefox
-skipMozilla Do not set the homepage for Mozilla based browsers (Netscape)
-skipSafari Do not set the homepage for Safari
@claudiogardini That was one of the first things I tried. This did not work for Safari but did work for Firefox and doesn't help for Chrome. For reference we are on MacOS 10.13, Safari 11.0.2, FF 61.0.2, and Chrome 68.
Edit: Managed to get Chrome working via notes https://www.jamf.com/jamf-nation/discussions/23233/google-chrome-homepage
On of my philosophies is when Jamf feature is broken.. I like to think why? And since "jamf setHomePage -homepage" has worked on again off again for years and years (over 8 years). A few years back I decided that it was Apple didn't want anybody changing Safari home page...that empower me to "convince" my "management" that if Apple doesn't want it then we really shouldn't be doing it ... and then in that same discussion I asked why? It came down to none of the macOS user were hitting the home page so the "stats looked bad" Then I pointed out that the macOS stats were the true users stats of the our home page... that ended the discussion and topic...
C
PS IF you have a web page that the user really need to visit and it's a complicate URL you can alway use self service too!!!
Has anyone tested @Cornoir scripts yet, I have been looking for anything to making this a little more stream lined and have looking at most of the relevant post pertaining to this. I have also tried jamf setHomePage for Firefox 62.0, Safari 11.1.2, Chrome 69.0
Not sure this will help but it's the last "trick" I had working before I gave up..
https://managingosx.wordpress.com/2015/02/02/command-line-tools-via-python-and-cocoa/
C
@claudiogardini This was working for me today with macOS Mojave and Firefox 66.0!
sudo jamf setHomePage -homepage https://www.google.com -feu -fut -skipIE -skipSafari
For Safari, check out my post here.
Hi
Does anyone have working .plist for firefox homepage?
I got the safari and chrome to work , but no luck with firefox!
many thanks in advance!!!