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 Responses

  1. Jeff G. March 26, 2005 / 11:23 am

    Good job on that, Chris, well written.

  2. Anonymous March 28, 2005 / 11:19 am

    Worked great! You da man.

  3. Anonymous March 31, 2005 / 6:58 am

    Thank you Chris! Your blog saved our day 🙂

  4. Anonymous April 13, 2005 / 8:28 pm

    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

  5. Anonymous April 13, 2005 / 8:29 pm

    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

  6. Anonymous June 10, 2005 / 2:12 am

    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!

  7. Anonymous July 7, 2005 / 11:29 am

    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.

  8. Josh July 15, 2005 / 1:45 pm

    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.

  9. Anonymous August 9, 2005 / 8:27 pm

    So how would you disable this feature if you didn’t know where the file was?

  10. robsta August 9, 2005 / 11:29 pm

    Thanks Chris, I’ve been looking for something similar to this for ages. This is going to be really useful.

  11. Josh August 22, 2005 / 11:54 am

    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…

  12. Karg August 24, 2005 / 2:13 am

    Works just great! Thanks!

  13. Anonymous August 25, 2005 / 1:58 pm

    To be precise, the mozilla.cfg file MUST reside in the FireFox.app/Contents/MacOS directory.

  14. Anonymous September 15, 2005 / 3:12 am

    Thanks m8 it worked for me 🙂
    looking for more stuffs like this 🙂

    Lord

  15. Anonymous September 26, 2005 / 9:24 am

    WOooooooooooow

    You guys r great!!!!!!!!!!!!!!

  16. Anonymous September 29, 2005 / 11:48 am

    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

  17. Chris Ilias September 30, 2005 / 9:46 am

    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.

  18. Anonymous December 8, 2005 / 6:32 pm

    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.

  19. Anonymous December 8, 2005 / 10:44 pm

    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

  20. Anonymous December 22, 2005 / 12:19 pm

    I almost scrapped Firefox at my district because I was unable to lock down settings….thanks!

    Melinda

  21. CCase January 6, 2006 / 11:42 am

    Chris,
    I got this to work on with XP OS but not with 98se. What am I doing wrong? Thanks for the help.
    CCase

  22. Anonymous January 17, 2006 / 4:47 pm

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

  23. Anonymous January 19, 2006 / 9:13 am

    Can you post the changes to make to all.js for FF1.5 to work the lockpref.

  24. twinprism February 3, 2006 / 1:19 am

    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

  25. Anonymous February 3, 2006 / 4:28 pm

    Its working GREAT for me except for the following code.

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

    Any ideas?

  26. Anonymous February 17, 2006 / 4:19 am

    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.

  27. Anonymous February 22, 2006 / 5:14 am

    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?

  28. Anonymous March 2, 2006 / 10:34 pm

    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.

  29. Squeaner March 3, 2006 / 10:01 pm

    This post has been removed by a blog administrator.

  30. dlbayne March 21, 2006 / 1:45 am

    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.

  31. Anonymous March 24, 2006 / 3:08 am

    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!

  32. Anonymous March 28, 2006 / 1:04 pm

    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

  33. Anonymous March 28, 2006 / 2:47 pm

    This post has been removed by a blog administrator.

  34. Anonymous April 10, 2006 / 2:48 pm

    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

  35. qua August 12, 2006 / 1:54 pm

    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

  36. ron August 14, 2006 / 2:18 pm

    for ubuntu add the lockPref code to /usr/lib/firefox/firefox.cfg

  37. jon August 23, 2006 / 10:05 pm

    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.