Skip to content

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.

{ 40 } Comments

  1. Jeff G. | March 26, 2005 at 11:23 am | Permalink

    Good job on that, Chris, well written.

  2. Anonymous | March 28, 2005 at 11:19 am | Permalink

    Worked great! You da man.

  3. Anonymous | March 31, 2005 at 6:58 am | Permalink

    Thank you Chris! Your blog saved our day :-)

  4. Anonymous | April 13, 2005 at 8:28 pm | Permalink

    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 at 8:29 pm | Permalink

    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 at 2:12 am | Permalink

    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 at 11:29 am | Permalink

    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 at 1:45 pm | Permalink

    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 at 8:27 pm | Permalink

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

  10. robsta | August 9, 2005 at 11:29 pm | Permalink

    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 at 11:54 am | Permalink

    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 at 2:13 am | Permalink

    Works just great! Thanks!

  13. Anonymous | August 25, 2005 at 1:58 pm | Permalink

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

  14. Anonymous | September 15, 2005 at 3:12 am | Permalink

    Thanks m8 it worked for me :)
    looking for more stuffs like this :)

    Lord

  15. Anonymous | September 26, 2005 at 9:24 am | Permalink

    WOooooooooooow

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

  16. Anonymous | September 29, 2005 at 11:48 am | Permalink

    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 at 9:46 am | Permalink

    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 at 6:32 pm | Permalink

    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 at 10:44 pm | Permalink

    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 at 12:19 pm | Permalink

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

    Melinda

  21. CCase | January 6, 2006 at 11:42 am | Permalink

    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 at 4:47 pm | Permalink

    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 at 9:13 am | Permalink

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

  24. twinprism | February 3, 2006 at 1:19 am | Permalink

    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 at 4:28 pm | Permalink

    Its working GREAT for me except for the following code.

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

    Any ideas?

  26. Mark Ferguson | February 8, 2006 at 2:42 pm | Permalink

    Chris:

    Can this method work on different OS X accounts? I want to use it on a student account, but not on admin. Thanks.
    Mark Ferguson
    mferguson2@cherrycreekschools.org

  27. Anonymous | February 17, 2006 at 4:19 am | Permalink

    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.

  28. Anonymous | February 22, 2006 at 5:14 am | Permalink

    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?

  29. Anonymous | March 2, 2006 at 10:34 pm | Permalink

    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.

  30. Squeaner | March 3, 2006 at 10:01 pm | Permalink

    This post has been removed by a blog administrator.

  31. dlbayne | March 21, 2006 at 1:45 am | Permalink

    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.

  32. Anonymous | March 24, 2006 at 3:08 am | Permalink

    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!

  33. Anonymous | March 28, 2006 at 1:04 pm | Permalink

    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

  34. Anonymous | March 28, 2006 at 2:47 pm | Permalink

    This post has been removed by a blog administrator.

  35. Anonymous | April 10, 2006 at 2:48 pm | Permalink

    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

  36. yaodownload2006 | April 19, 2006 at 1:37 am | Permalink

    IziLock Easily lock your Windows folder with password !

  37. Michael Kaply | May 19, 2006 at 4:30 pm | Permalink

    I added locked preferences support to the CCK.

    Much easier

    http://www.mozilla.org/projects/cck/firefox

  38. qua | August 12, 2006 at 1:54 pm | Permalink

    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

  39. ron | August 14, 2006 at 2:18 pm | Permalink

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

  40. jon | August 23, 2006 at 10:05 pm | Permalink

    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)?

{ 7 } Trackbacks

  1. Lock Firefox Preferences - enrii.blog | November 6, 2006 at 9:52 pm | Permalink

    [...] Reference: Locking Mozilla Firefox Settings [...]

  2. [...] it. I hope. Thanks to this blog for giving a great tutorial on [...]

  3. [...] http://ilias.ca/blog/2005/03/locking-mozilla-firefox-settings/ [...]

  4. [...] Chris Ilias’ Blog ” Locking Mozilla Firefox Settings I still dream of Organon … of Mozilla Firefox and you want to lock certain settings/options, so users cannot edit them. … Archive ” Lock Firefox Settings … [...]

  5. [...] MozillaZine KnowledgeBase: Locking preferences MozillaZine KnowledgeBase: Configuration utilities for administrators Chris Ilias Blog: Locking mozilla firefox settings [...]

  6. [...] Group policy… we also figured out other browsers such as Firefox we used this site we fouind. Chris Ilias’ Blog ยป Locking Mozilla Firefox Settings Not sure if checkpoint web filtering is able to do what you want….but i would think so. [...]

  7. change firefox homepage | June 19, 2008 at 11:34 am | Permalink

    [...] them. For instance you may want to prevent people from changing the proxy setting, the homepage, thehttp://ilias.ca/blog/2005/03/locking-mozilla-firefox-settings/JS Online: Setting Your Browser&39s Home Page1. Go to Preferences in the firefox menu of your [...]