Opened 2 years ago

Closed 2 years ago

#21301 closed enhancement (worksforme)

Adjustable parameters for torrc-defaults file path and "Tor files" directory path

Reported by: proxybrain Owned by: tbb-team
Priority: Medium Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: tbb-usability
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


I propose that the firefox binary be augmented to support either command-line flags and/or to look for environment variables that specify where the torrc-defaults file is located; and related, where the "Tor files" directory should be located/created. If it's not possible to augment the binary in this way, perhaps the paths can be configurable via firefox profile settings loaded immediately upon launch?

Presently, the torrc-defaults file is always looked for in a hard-coded directory relative to the binary. On macOS that's <app>/Contents/MacOS/../Resources/TorBrowser/Tor. And the "Tor files" directory is always located/created in a directory two levels up from the firefox profile-directory.

Those hard-wired settings make it nigh impossible, for example, to use TBB in conjunction with geckodriver, which always invokes the binary with a --profile setting that has a parent path common to all invocations (barring OS reboots); thus, multiple running instances will collide over their "Tor files" directories. See: Command-line parameter for parent path of profile-directory?.

Child Tickets

Change History (6)

comment:1 Changed 2 years ago by proxybrain

Keywords: torrc-defaults added
Version: Tor:

comment:2 Changed 2 years ago by proxybrain

Keywords: DataDirectory firefox profile added

comment:3 Changed 2 years ago by gk

Keywords: tbb-usability added; torrc-defaults DataDirectory firefox profile removed
Version: Tor:

comment:4 Changed 2 years ago by mcs

Status: newneeds_information

There are some preferences available (modify them via about:config or by editing prefs.js within the browser profile while Tor Browser is not running):


See for all of the hiddem preferences (and comments that explain how they can be used).

Do these preferences meet your needs? I would rather not add support for more environment variables due to the complexity that it will introduce.

And please use a custom torrc if possible rather than modifying torrc-defaults.

comment:5 Changed 2 years ago by proxybrain

Thank you for the helpful suggestions. I was able to use the preferences and custom torrc (vs. torrc-defaults) you suggested to achieve my desired configurations. One point of difficulty that took awhile to debug was owed to extensions.torlauncher.tordatadir_path and extensions.torlauncher.torrc_path having maximum supported lengths, with respect to the tor executable (or so it seems). It was not clear to me why I was experiencing repeat failed launches of TBB, until I lucked out in noticing a tor log entry re: the path-length. Once I got that sorted out, all worked as desired.

Here's a closely related question:

Let firefox be the TBB executable and /some/path be an empty directory; these commands produce rather different output in /some/path:

firefox --profile=/some/path

firefox -CreateProfile "some_name /some/path"

How can I generate the same output that results from the first command – let's call it the TBB default profile – but without starting the TBB application per se?

The -CreateProfile option is going the right direction, since it exits after writing to disk, but doesn't output the TBB default profile.

My use case: when the TBB executable is invoked by Selenium (+gecko-driver) and when Selenium is not supplied with a custom profile, then a profile is created for the driven instance that is entirely different from the TBB default profile, one which does not function properly. Why that's the case, I'm not sure. It's possible, of course, to manually generate the TBB default profile by way of a TBB launch that's aborted after the expected files are written to disk. Then one can copy around those files and pass them – plus user.js – to Selenium as a custom profile for the TBB instance/s Selenium will launch. However, that initial profile generation adds a bit of a wild hair to the automation process; for example, one has to manually keep a manifest of what's in the TBB default profile, which could change across releases. So, all considered, the automation process would be much simpler if it were possible to invoke the TBB executable such that it writes the TBB default profile to disk, at a specified path, and then exits.

I will be happy to turn this inquiry (feature request?) into a separate ticket, but I felt it made sense to ask here first since it's closely related to customization of TBB profiles per the preferences you recommended.

comment:6 in reply to:  5 Changed 2 years ago by mcs

Resolution: worksforme
Status: needs_informationclosed

Replying to proxybrain:

So, all considered, the automation process would be much simpler if it were possible to invoke the TBB executable such that it writes the TBB default profile to disk, at a specified path, and then exits.

I am sorry for the delayed response (I just found this ticket again by chance). Since we fixed #13252, new profiles are created with the correct files and settings on OSX. This is not yet true on Windows or Linux although we hope to fix that someday (see #18367 and #18369).

Note: See TracTickets for help on using tickets.