Locking Mozilla Firefox Settings


Note: If you need assistance on implementing these instructions, ask in the mozilla.support.firefox newsgroup. Not in a comment to this blog post.

Let’s say you are the administrator of one or more installations of Mozilla Firefox and you want to lock certain settings/options, so users cannot edit them. For instance you may want to prevent people from changing the proxy setting, the homepage, the ability to save passwords, etc.

It is possible, but it’s a little complicated.

First you need to find out what the names are of the preferences you wish to lock. The best way to do this is by entering about:config in the Firefox location bar. Every preference that has been used will appear in the resulting list. You can use the filter field to search for preferences that contain certain words. For instance, if you’re looking for the homepage URL setting, just type homepage in the filter field. For more info on preference names, and about:config see:
http://kb.mozillazine.org/About:config

Next, create a file anywhere on your hard drive, called mozilla.txt. Open mozilla.txt in a text editor (Notepad), and begin the first line with two forward slashes. The following lines will contain the preferences you want to lock, and their values. They should be in the same form as you see them in your profile’s prefs.js file, with one exception: instead of using user_pref, use lockPref. For instance, if you want to lock the proxy at “direct connection“, and lock the homepage at (forgive the ego) http://ilias.ca, the contents of your mozilla.txt file would look like this:
//
lockPref("network.proxy.type", 0);
lockPref("browser.startup.homepage", "http://ilias.ca/");

Here’s where it gets tricky. The file must be encoded, and renamed. The encoding is a simple “byte-shifting” with an offset of 13. You can download a program that will do this here, or use an online encoder here.

The resulting file should be named mozilla.cfg. Save that in the same directory as firefox.exe.

Last step: In C:\Program Files\Mozilla Firefox\greprefs\ there’s a file called all.js. Open all.js in a text editor, and add the following line at the end of it:
pref("general.config.filename", "mozilla.cfg");

Save, close, and start Firefox to test it.

47 Replies to “Locking Mozilla Firefox Settings”

  1. Chris, I looked all over to find how to do that, so i’m not sure how you figured it out. But thanxs as it gives us a working solution to our problem. Good work

  2. Chris, I looked all over to find how to do that, so i’m not sure how you figured it out. But thanxs as it gives us a working solution to our problem. Good work

  3. Chris,

    Thanks for the great info – it plugs a gaping hole in Firefox. My problem is that I’m using Mac OS X, so the solution is not an exact fit. While there is still the Mozilla “prefs.js” file on OS X, the path to saving in the same file as Firefox.exe, etc., just don’t work. I can create a .rtf file with the amended prefs.js language and convert it via the web converter, but I’m pretty much lost at that point. Any thoughts? There just has to be a way to lock this proxy use down in Firefox for OS X!

  4. this didnt work for me.
    i went to the site that is linked with the online byteshifter and they say there is a file called profiles.ini in the mozilla firefox folder and there isnt. what am i missing there? also after trying your little fix to lock it down, i came upon an error of some sort, the browser didnt keep any security features i wanted and the url text box wouldnt show the url.

  5. OK, so I figured out how to use this method on Mac OS X. Basically, it is the same, but instead of saving the mozilla.cfg file to C:Program FilesMozilla Firefox you need to go to wherever your Firefox program icon is (probably in your Applications folder), right-click (or command-click) it and select ‘Show Package Contents’. The greprefs folder which contains the all.js file to be edited is also here.

    Let me know by email (see my Blogger profile) if this doesn’t work for you.

  6. I left out one key thing from the Mac solution above. The mozilla.cfg file MUST be int he top-level of the application package for this to work…

  7. Thank you very much this has helped us a great deal. But there is one preference that we cannot get to lock. It’s in the tabbed browsing section, open external links in a new window.
    This is the statement that we have in mozilla.cfg
    lockPref(“browserlink.open_external”,2);
    Any ideas? Thanks in advance, Laurie

  8. Anonymous said…
    …there is one preference that we cannot get to lock.

    lockPref(“browserlink.open_external”,2);

    You’re missing a period in the preference line, between browser and link.
    lockPref(“browser.link.open_external”, 2);

    Any questions should be posted in the Firefox newsgroup.

  9. The all.js file changes sifnifigantly in version 1.5 you can re-use the mozilla.cfg file but start with a fresh all.js and add the relevant lines again.

  10. Hi Chris,

    I tried but its not working out for me. I am using FF ver. 1.5 and Windows 2003 OS. I followed all the instructions as is. But still I’m unable to do it. please I need further instructions.

    Thanks in advance,

    Vinay

  11. thanks this gave me a good reason to just do something to by bro who is IT but still can figure this out

  12. Works fine with Firefox 1.5, if you re-add the pref statement to all.js

    One thing that got me for a moment, watch the difference between
    user_pref and lockPref
    make sure to remove the underscore if you set options and then copy from prefs.js

  13. Its working GREAT for me except for the following code.

    lockPref(“network.proxy.http”, 207.75.214.7);

    Any ideas?

  14. It works great for the administrator account; but I get the message “Cannot locate the configuration file” when using a limited account under Windows XP. Any suggestions? I’m sure there is a solution. Thanks for the information.

  15. The instructions seem nice and detailed but they just don’t work for me!

    I’m using Mac OSX panther, Firefox 1.5 and every time I try and start it with the changes I get an error saying: “Configuration Error. Failed to read the configuration file. Please contact your system administrator”

    Any thoughts?

  16. With OS X 10.4.5 running firefox 1.5.0.1 I have been unable to avoid the configuration error arising in the prefcalls.js. However, some of the locks do take effect. This has been noted on the mozilla forums as a bug, but no one has addressed this, so until someone can post back here that this issue has been solved, I recommend that people NOT use this solution.

  17. As a follow-up to my Feb 17, 2006 comment, I found a suggestion in the following forum:

    http://forums.mozillazine.org/viewtopic.php?p=2159534#2159534

    I had success putting the byteshifted file into /usr/local settings/firefox. First I tried “all users”, which only seemed to work for the administrator account. Then I tried putting a copy of the file in each limited user’s “local settings”. I still seemed to have problems with the limited accounts. Then for some reason I removed all copies from all users’ so that the file only existed in the Firefox program directory (as per Chris Ilias’ instructions). Now all users can access Firefox just fine and the lockprefs are doing their job. Go figure. The only other thing I did was to delete all files in /local settings/temp and /recent. (I don’t recommend anyone else try this; I just took a chance.) Perhaps Firefox was looking at a cache. Or maybe that had nothing to do with the positive result. I have no idea.

  18. Yeah, I can confirm that on Mac OS X 10.4.4 / Mozilla 1.5.0.1, this solution doesn’t work.

    I triple-checked everything and I still get the error message when the browser tries to open.

    Please fix.

    P.S. Macs rock!

  19. i have this working with 10.4.x Recreated my clones with 10.4.5 added in the firefox tweaks, no prob. Just thought you would like to know it is possible

  20. We had some problems with 4.5.0.1 and locked settings. The error we received had something to do with a boolean error on line 91 in the prefcalls file. When we launched Firefox, the settings would lock correctly, but we would receive a long error message that started out with “Netscape.cfg/Autoconfig failed”

    It turned out that the “privacy.popups.policy” setting in our encoded file had changed from a boolean value to an integer across the Firefox versions. We changed it from true to 1 and the problem was fixed. Removing it also fixed the problem.

    Hope this helps.

    Bill

  21. cant seem to get the hang of this on my windows 2000 console what else do i need to do as i have done the procedure in a step by step fashion and still no break through
    would appreciate any form of assitance

  22. I can’t get this to work on my Win 2000/XP systems either. Followed the steps line by line… 🙁 Does something change with the latest version of Firefox (1.5.0.6)?

Comments are closed.