Scripting "home" Page for Firefox

ducharmec
New Contributor

I am currently trying to create a script that will set the home page in
Firefox, and then send it using Casper remote. Has anyone been
successful in the process?

Currently using:

#!/bin/sh

sudo usr/sbin/jamf setHomePage -feu -fet -homepage http://www.(homepage
<http://www.(homepage/> url)

I am fairly new to writing shell scripts. Any ideas?

Cynthia R. DuCharme

Technical Support SpecialistHelpdesk Support

VM 763-391-7221

![external image link](attachments/2faa67d97ffb48198aa9b6fdea86cb46)

15 REPLIES 15

Not applicable

sudo is not necessary, since you're already running as root, and the correct path is /usr/sbin/jamf.

Try it like this:

#!/bin/sh

/usr/sbin/jamf setHomePage -feu -fut -homepage http://homepage/url/here

Not applicable
"Urban, Benjamin Mark" <BUrban at imf.org> writes: I am currently trying to create a script that will set the home page in Firefox, and then send it using Casper remote. Has anyone been successful in the process?

Is managing Firefox settings even an option using scripts? I was under the impression that Firefox used it's own style of user preference files and profile structure and wasn't manageable in this regard except for creating prebuilt Firefox profiles in the User Template folder.

If I'm wrong, then someone please correct me here. And I would love to be wrong about this.

Gene Anderson
Systems Analyst, ACTC, MCP
Pembina Hills Regional Division No.7
Phone: (780) 674-8535 ext 6860
email: ganderson at phrd.ab.ca

No one really listens to anyone else, and if you try it for a while you'll see why. - Mignon McLaughlin

Not applicable
 

tlarkin
Honored Contributor

Firefox has it's own set of prefs, which do not abide by OS X's
standards. Not sure if this is the answer but here are the command line
arguments

http://kb.mozillazine.org/Command_line_arguments#For_Linux_and_Mac_OS_X_users

![external image link](attachments/9de447c46e3e4f36ba837c9171f3e618)

talkingmoose
Moderator
Moderator
On 5/2/11 10:41 AM, "DuCharme, Cynthia (ESC)" <DuCharmeC at District279.org> wrote: I am currently trying to create a script that will set the home page in Firefox, and then send it using Casper remote. Has anyone been successful in the process?

No need to write a script if you're going to use Casper Remote or a policy.

Enter your command:

/usr/sbin/jamf setHomePage -feu -fut -homepage http://www.example.com

into the Run Command field under the Advanced tab and send it to your
machines.

Also, if you're going to run any scripts using Casper then they are
automatically run as root. No need to include "sudo" before your command.

--

William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492

rockpapergoat
Contributor III

you should use the cck wizard firefox extension to build your customization, then deploy. way easier than monkeying with a script.

I have a firefox extension installer pkg template here: http://github.com/tspgit/luggage/firefox-extension

firefox doesn't honor the system wide default homepage, as others have mentioned, so you can't use the jamf binary to set it.

CasperSally
Valued Contributor II

I did this earlier in the year by opening my Firefox package in composer and drilling down to the part of the package that sets home directory (few levels deep, I don’t remember exact location) and manually changing in the file and pushing out the whole FF package again to those machines again.

rockpapergoat
Contributor III

further followup, since i was sending from my phone before.

here's a direct link to the cck plugin: https://addons.mozilla.org/en-US/firefox/addon/cck/

the advantage of doing it this way is that you don't need to mess with creating a separate firefox installer, and it will work across firefox updates.

here's a note about using this method: http://managingosx.wordpress.com/2010/10/06/firefox-global-extensions-again/

dhowell
Contributor

here is a Page on some of the Command line stuff you can do.

http://kb.mozillazine.org/Command_line_arguments#For_Linux_and_Mac_OS_X_users

D. Trey Howell ACMT, ACHDS, CCA
trey.howell at austinisd.org
Desktop Engineering
twitter @aisdmacgeek

tlarkin
Honored Contributor

If you read Greg Neagles post on his blog about managing FireFox with
CCK, it is possible. I do not recall all the details but if you google
his blog you will find it

-Tom

rockpapergoat
Contributor III

firefox prefs are stored as javascript, so they're editable. it's way easier to deploy changes or manage settings via the cck extension method.

talkingmoose
Moderator
Moderator

You're correct that Firefox uses non-standard (non Mac OS) methods for
On 5/2/11 11:06 AM, "Gene Anderson" <ganderson at phrd.ab.ca> wrote:
storing user data. That means it's at least not manageable using something
like MCX, defaults or plistbuddy.

Mozilla's mentality is similar to Adobe's. They want to develop once and
port to multiple platforms making things platform agnostic. Good for them
but bad for administrators.

IMHO, it's not worth my time trying to research, dissect and understand
another non-standard application when someone else has already created
something like the CCK for me to be able to manage Firefox. I'll add a "me
too" to Nate's remarks. This is an easier way to go.

<https://addons.mozilla.org/en-US/firefox/addon/cck/>

--

William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492

sean
Valued Contributor

As most have mentioned, Firefox has it's own preferences.

For example, in the users Application Support/Firefox directories, there is a prefs.js that has a line like:

user_pref("browser.startup.homepage", "http://google.com/");

Which you could edit.

Alternatively, you could edit the application itself and provide a similar line in it's preference file. If the user has one set, I believe it overrides the application one, so I doubt you can truly dictate a page that is always present. I've never looked at the cck, so maybe this is better.

You can have more than one tab too if you like:

user_pref("browser.startup.homepage", "http://google.com/|http://http://www.jamfsoftware.com/");

Sean

![external image link](attachments/c02cf0c099104ffc9b86eb7a77f5ab27)

deej
New Contributor III

All you have to do is echo settings to the end of the prefs.js file.

So, once you establish $prefsfile = /path/to/prefs.js:

echo "user_pref("app.update.enabled", false);" >> $prefsfile
echo "user_pref("app.update.auto", false);" >> $prefsfile
echo "user_pref("browser.startup.homepage", "http://your.web.site");" >> $prefsfile

On quit, Firefox "flattens" prefs.js by flushing the unnecessary settings out of it (later ones trump earlier ones), so it's safe to just concatenate settings to the end of the file on every run of the script; you won't end up with hundreds of instances of the same setting. We've been doing this since Mozilla 1.x.

You might also like to take a look at Firefox's lockdown feature:

http://www.pcc-services.com/kixtart/firefox-lockdown.html

Not applicable

Don't know if anyone's interested but I have a Ruby class and sample script
(a bit rough on the script) to update Firefox prefs for all users. It's
basic but we use it and it works for the basic stuff that we do.

http://dl.dropbox.com/u/1826667/firefox.zip