Search code examples
firefoxincognito-mode

How to permanently disable private browsing in Firefox?


I am using Ubuntu 20.04 and Firefox 91.0. I want to disable permanently the private browsing (incognito mode).

Especially, I want to stop the keyboard shortcut from working.

How can I do that?


Solution

  • Follow the recipe:

      1. In terminal, go to: /usr/lib/firefox/distribution

    Obs.: This is the correct directory if you are using Firefox version 91.0 and Ubuntu 20.04. Depending on the Firefox version and/or OS this might be different.

      1. If there is no policies.json file, then create one:
     $ sudo touch policies.json
    
      1. The file's content needs to be:
    {
      "policies": {
        "DisablePrivateBrowsing": true
      }
    }
    
      1. If you are facing problems with "read-only", invoke your favorite editor using sudo, such as:
    $ sudo emacs policies.json 
    $ sudo vim policies.json 
    $ sudo gedit policies.json 
    
      1. Re-start Firefox and try using Control-Shift-P. Hopefully, it won't work.