HOWTO Lockdown Mozilla Preferences for LTSP

Version 0.1
Copyright 2004 Warren Togami <>

Table of Contents
  1. Introduction
  2. Revision History
  4. Quick Instructions
  5. Mozilla Options
  6. Conclusion
  7. Links to More Resources

1. Introduction
This short guide explains how you can lockdown Mozilla preferences for all users on Linux system to options which you define.  Locking down of Mozilla preferences can be useful in public kiosks, school, university or business computers where you want certain options (like a standard homepage) set and you do not want users to be able to modify it.

This particular document was put together to be a succinct and quick example of locking down preferences to be suitable for a K12LTSP school environment.  See the Links to More Resources at the end of this document to more advanced details of Mozilla and Netscape default preference setting & locking.

These directions were last tested on Fedora Core with mozilla-1.6 and firefox-0.8, but would probably work with other recent versions of Mozilla and other brands of Linux.

2. Revision History

Version 0.2 - February 25, 2004
* Include sample for Firefox 0.8
* Fix mozilla.cfg path in pref/all.js because it no longer works in mozilla-1.6 and firefox-0.8
Version 0.1 - September 14, 2003
* Initial Release

Download these two files, then read Instructions in the next section. - Perl script to byteshift a file, necessary for encoding the Mozilla .cfg file.
mozilla.js - Example configuration file.  You will want to edit it, or create your own.
firefox.js - Example configuration for Firefox 0.8.

4. Quick Instructions
  1. Save into /usr/local/bin
  2. chmod 755 /usr/local/bin/
    This step makes the script executable.
  3. Copy mozilla.js into the home directory of your Mozilla browser.  Scripts call this directory MOZILLA_FIVE_HOME.  This is where you will find the browser executables, default preferences and more.
  4. Edit mozilla.js to suit your needs.  Read the next section Mozilla Options to learn what other options are available.
  5. -s 13 < mozilla.js > mozilla.cfg
    This encodes the contents of mozilla.js into mozilla.cfg.  It seems incredibly illogical and without any technical reason why it was designed this way, but it needs to be done.  Repeat this step every time you edit mozilla.js so the changes will exist within mozilla.cfg.
  6. Edit /usr/lib/mozilla-VERSION/defaults/pref/all.js substituting VERSION with the actual directory name
    Add the following line at the bottom:
    pref("general.config.filename", "mozilla.cfg");

5. Mozilla Options
It is beyond the scope of the document to describe all possible Mozilla options that can be set or locked in mozilla.js, though unfortunately this is currently a poorly documented section of Mozilla's site.  Please see Mozilla's Documentation on the subject of preferences.  Otherwise this following method of capturing the preferences never fails.
  1. Close Mozilla.
  2. Go into ~/.mozilla/default/XXXXXXXXXX.slt and make a backup copy of prefs.js in another directory.
    cp prefs.js ~/
  3. Open Mozilla and configure preferences using the GUI menus.
  4. Close Mozilla so those preferences are saved to the files.
  5. Go back into the directory in #2 above, then compare the difference between the old and new configuration file using:
    diff -u ~/prefs.js prefs.js
  6. Place options into mozilla.js using the existing options for  syntax examples.  You may need to do some editing of options, and unfortunately some options cannot be included like browser.cache.disk.parent_directory because it points to a user specific directory.

6. Conclusion
At this point whenever any user runs Mozilla, it should use the options that you have specified in mozilla.js, and will be locked from user changes.  Do not forget to rerun after you edit mozilla.js, or the changes cannot be seen by Mozilla.

7. Links to More Resources