First, you shouldn't use Firefox - or X Windows at all - as root as it's a security vulnerability. These applications are meant to be run with non-administrative privileges, in which case any bug or flaw in them would cause limited damage to your system.
To answer your question:
If you're putting together an installer that needs to be able to install extensions for a toolkit-based application, such as Firefox or anything using XULRunner, Gecko 1.9 (Firefox 3) introduces an easy way to do this for Windows, OS X and Linux. Windows users have also had the ability to install extensions using the registry for some time. Now, on OS X and Linux, you can simply copy the extension into a predefined directory on the user's computer.
To install extensions into these directories you must extract the extension to a directory with the same name as the the extension's ID. The ID is defined in the install.rdf
of the extension, between the <em:id></em:id>
tags. For WebExtensions based add-ons the ID is the value of the applications.gecko.id
property within the manifest.json
file.
To install an extension to be used by all users on Linux, copy it to:
/usr/lib/<vendor>/extensions/<appid>/
Or...
/usr/lib64/<vendor>/extensions/<appid>/
Or...
/usr/share/<vendor>/extensions/<appid>/
To install an extension just for a specific user:
~/.<vendor>/extensions/<appid>/
(Source: https://developer.mozilla.org/en-US/Add-ons/Installing_extensions)