How to customise Firefox installs using mozilla.cfg

Firefox has the ability to customise installations using a configuration file called mozilla.cfg.

This file sits in the Firefox install directory, and each time Firefox is loaded it’s checked for any custom configurations that have been added.

What settings are available?

There are a huge number of settings avaible – these can be viewed by entering about:config into the Firefox address bar. Common settings that are customised are proxy settings, home page and disabling the ability to install add-ons.

To prepare your mozilla.cfg you will need to identify the settings from this list.

The quickest way to do this is to configure Firefox as you would like it first, for example add a proxy server.

Then browse to about:config and either use the ‘filter’ option or sort by ‘status’ to find the user set settings.

The setting name will appear under ‘Perfence Name’ and the value under ‘Value’.

These are used in the mozilla.cgf file like this

pref("network.proxy.ftp", "proxy.server.local");

SCCM-Firefox3

How to add settings to mozilla.cfg

Create a text file, save it as mozilla.cfg and add your configurations in each line.

For example

//Firefox Default Settings
// set Firefox Default homepage
pref("browser.startup.homepage","http://www.itsupportguides.com");
// disable default browser check
pref("browser.shell.checkDefaultBrowser", false);
pref("browser.startup.homepage_override.mstone", "ignore");
// disable application updates
pref("app.update.enabled", false)
// disables the 'know your rights' button from displaying on first run
pref("browser.rights.3.shown", true);
// disables the request to send performance data from displaying
pref("toolkit.telemetry.prompted", 2);
pref("toolkit.telemetry.rejected", true);

How do I install mozilla.cfg on a computer?

You will need to save two files to the Firefox install folder – local-settings.js and mozilla.cfg

local-settings.js is a plain text file. Use the contents below and save to

C:\Program Files (x86)\Mozilla Firefox\defaults\pref (assuming you have installed Firefox in the default folder path)

pref("general.config.filename", "mozilla.cfg");

mozilla.cfg as explained above, is also a plain text file. Using your copy of mozilla.cfg, save to

C:\Program Files (x86)\Mozilla Firefox (assuming you have installed Firefox in the default folder path)

How to distribute mozilla.cfg with your Firefox install?

To distribute the settings with your Firefox install you will several files:

  • install.cmd – a batch script to do the installation then copy the configuration files
  • local-settings.js
  • mozilla.cfg – which holds your settings

install.cmd

echo Installing Firefox - Please Wait.
echo Window will close after install is complete
REM Installing Firefox
"%~dp0Firefox Setup 41.0.2.exe" -ms
REM Install 32-bit customisations
if exist "%programfiles%\Mozilla Firefox\" copy /Y "%~dp0override.ini" "%programfiles%\Mozilla Firefox\browser\"
if exist "%programfiles%\Mozilla Firefox\" copy /Y "%~dp0mozilla.cfg" "%programfiles%\Mozilla Firefox\"
if exist "%programfiles%\Mozilla Firefox\" copy /Y "%~dp0local-settings.js" "%programfiles%\Mozilla Firefox\defaults\pref"
REM Install 64-bit customisations
if exist "%ProgramFiles(x86)%\Mozilla Firefox\" copy /Y "%~dp0override.ini" "%ProgramFiles(x86)%\Mozilla Firefox\browser\"
if exist "%ProgramFiles(x86)%\Mozilla Firefox\" copy /Y "%~dp0mozilla.cfg" "%ProgramFiles(x86)%\Mozilla Firefox\"
if exist "%ProgramFiles(x86)%\Mozilla Firefox\" copy /Y "%~dp0local-settings.js" "%ProgramFiles(x86)%\Mozilla Firefox\defaults\pref"

local-settings.js

pref("general.config.filename", "mozilla.cfg");

mozilla.cfg

This will hold your settings, but as an example

//Firefox Default Settings
// set Firefox Default homepage
pref("browser.startup.homepage","http://www.itsupportguides.com");
// disable default browser check
pref("browser.shell.checkDefaultBrowser", false);
pref("browser.startup.homepage_override.mstone", "ignore");
// disable application updates
pref("app.update.enabled", false)
// disables the 'know your rights' button from displaying on first run
pref("browser.rights.3.shown", true);
// disables the request to send performance data from displaying
pref("toolkit.telemetry.prompted", 2);
pref("toolkit.telemetry.rejected", true)

Now you can distribute your custom Firefox install with settings by distributing these files and running install.cmd