[GH-ISSUE #1398] Allow custom temporary (--private) profile #956

Closed
opened 2026-05-05 07:13:09 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @rieje on GitHub (Jul 23, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1398

One thing I think would be extremely useful is allowing to use a custom profile for temporary (--private) sessions that is currently loaded in memory (rather than on disk). At the moment, only the Firefox default settings can be used. The problem with using --private <directory> is it's not a temporary profile--your browser fingerprint/activity builds up over time whether or not you delete your cookies and wipe the cache every session--stuff gets saved on disk and it's not practical nor possible to deal with all the data that gets written throughout and across sessions.

Why is this useful? You get the benefits of a truly temporary profiles while keeping your addons and their settings as well as browser settings. You get the same environment you're familiar with. It can have its own set of defined/"temporary" bookmarks for easy access, addons like uBlock Origin means no aggressive ads, etc.

I wonder how difficult it is to implement such a feature. An example I'm thinking of is making a copy of your current /usr/lib64/firefox directory and have a setting point to that copy to load that custom profile as a temporary session.

Originally created by @rieje on GitHub (Jul 23, 2017). Original GitHub issue: https://github.com/netblue30/firejail/issues/1398 One thing I think would be extremely useful is allowing to use a custom profile for temporary (--private) sessions that is currently loaded in memory (rather than on disk). At the moment, only the Firefox default settings can be used. The problem with using `--private <directory>` is it's not a temporary profile--your browser fingerprint/activity builds up over time whether or not you delete your cookies and wipe the cache every session--stuff gets saved on disk and it's not practical nor possible to deal with all the data that gets written throughout and across sessions. Why is this useful? You get the benefits of a truly temporary profiles while keeping your addons and their settings as well as browser settings. You get the same environment you're familiar with. It can have its own set of defined/"temporary" bookmarks for easy access, addons like uBlock Origin means no aggressive ads, etc. I wonder how difficult it is to implement such a feature. An example I'm thinking of is making a copy of your current `/usr/lib64/firefox` directory and have a setting point to that copy to load that custom profile as a temporary session.
gitea-mirror 2026-05-05 07:13:09 -06:00
Author
Owner

@netblue30 commented on GitHub (Jul 29, 2017):

Look at --private-home in man page. Is this what you need?

<!-- gh-comment-id:318826957 --> @netblue30 commented on GitHub (Jul 29, 2017): Look at --private-home in man page. Is this what you need?
Author
Owner

@Hocuri commented on GitHub (Aug 21, 2017):

I would also like this feature. I can't find --private-home in the man pages but I assume you meant --private.
But unfortunately, as @rieje already pointed out:

At the moment, only the Firefox default settings can be used

because you can't configure a folder whose content is copied to the temporary home.

What would be needed is a mixture from --private and --private=: A temporary home which is initialized with the content of another folder.

On the other hand, this can also be done by a script like this one: (so it is not that urgent)
mkdir .home-tmp
cp -R .mozilla .home-tmp
firejail --private=.home-tmp
rm -r .home-tmp

<!-- gh-comment-id:323794794 --> @Hocuri commented on GitHub (Aug 21, 2017): I would also like this feature. I can't find --private-home in the man pages but I assume you meant --private. But unfortunately, as @rieje already pointed out: > At the moment, only the Firefox default settings can be used because you can't configure a folder whose content is copied to the temporary home. What would be needed is a mixture from --private and --private=<directory>: A temporary home which is initialized with the content of another folder. On the other hand, this can also be done by a script like this one: (so it is not that urgent) `mkdir .home-tmp` `cp -R .mozilla .home-tmp` `firejail --private=.home-tmp` `rm -r .home-tmp`
Author
Owner

@rieje commented on GitHub (Aug 23, 2017):

@netblue30 Sorry for the late response, but this is exactly what I was looking for--works great. However, due to the way it works where it copies ~/.mozilla to the temp filesystem for my particular example (since I want the the temporary sandbox to use my existing extensions), it requires I actually have my Firefox settings in ~/.mozilla. I actually don't--I never run Firefox without a sandbox so I never had a ~/.mozilla. Instead, I have all my --private= directories like so:

~/.firejail/firefox-profile1/
~/.firejail/firefox-profile2/
~/.firejail/firefox-profile3/
...

I had to run Firefox once without a sandbox so ~/.mozilla contents gets generated and then I cp ~/.firejail/firefox-profile1/.mozilla/firefox/main/* ~/.mozilla/firefox/main/ before I could use --private-home.

Besides this workaround, it also means I have to do this every time I want to use --private-home with different settings. It would be really nice to somehow allow specifying a destination path to the temporary filesystem, which allows for significantly more flexibility like being able to easily run different profile settings. It might look something like this --private-main=~/.firejail/firefox-profile1/.mozilla/firefox/main/ which copies the contents of the directory of --private-main to the temporary filesystem's ~/.mozilla/firefox/<xxxxxxx>.default/. So you can specify your own settings that are not necessarily in ~/.mozilla and can also easily switch which settings to use by changing the argument of --private-main.

@Hocceruser

--private-home is documented in the man and works as you expect:

--private-home=file,directory
          Build a new user home in a temporary filesystem, and copy the files and directories in the list in the new  home.
          All modifications are discarded when the sandbox is closed.

          Example:
          $ firejail --private-home=.mozilla firefox
<!-- gh-comment-id:324223111 --> @rieje commented on GitHub (Aug 23, 2017): @netblue30 Sorry for the late response, but this is exactly what I was looking for--works great. However, due to the way it works where it copies `~/.mozilla` to the temp filesystem for my particular example (since I want the the temporary sandbox to use my existing extensions), it requires I actually have my Firefox settings in `~/.mozilla`. I actually don't--I never run Firefox without a sandbox so I never had a `~/.mozilla`. Instead, I have all my `--private=` directories like so: ~/.firejail/firefox-profile1/ ~/.firejail/firefox-profile2/ ~/.firejail/firefox-profile3/ ... I had to run Firefox once without a sandbox so `~/.mozilla` contents gets generated and then I `cp ~/.firejail/firefox-profile1/.mozilla/firefox/main/* ~/.mozilla/firefox/main/` before I could use `--private-home`. Besides this workaround, it also means I have to do this every time I want to use `--private-home` with different settings. It would be really nice to somehow allow specifying a destination path to the temporary filesystem, which allows for significantly more flexibility like being able to easily run different profile settings. It might look something like this `--private-main=~/.firejail/firefox-profile1/.mozilla/firefox/main/` which copies the *contents* of the directory of `--private-main` to the temporary filesystem's `~/.mozilla/firefox/<xxxxxxx>.default/`. So you can specify your own settings that are not necessarily in `~/.mozilla` and can also easily switch which settings to use by changing the argument of `--private-main`. @Hocceruser `--private-home` is documented in the `man` and works as you expect: > --private-home=file,directory Build a new user home in a temporary filesystem, and copy the files and directories in the list in the new home. All modifications are discarded when the sandbox is closed. Example: $ firejail --private-home=.mozilla firefox
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#956
No description provided.