• caglararli@hotmail.com
  • 05386281520

How to blacklist parent dir and whitelist child dir in firejail

Çağlar Arlı      -    11 Views

How to blacklist parent dir and whitelist child dir in firejail

How can I blacklist some directory [a] and whitelist some directory [b], where [b] is a directory inside of [a]?

I'm trying to figure out how to execute a firefox profile in a firejail such that it cannot see other firefox profiles.

Firefox profiles are located in the following directory:

$HOME/.mozilla/firefox/<profile_id>/

So, let's assume I have two profiles

user@host:~$ ls ~/.mozilla/firefox/
everyday_profile
firejailed_profile
user@host:~$ 

I've tried to execute firefox in a firejail where ~/.mozilla/firefox/firejailed_profile is in the whitelist and ~/.mozilla/firefox/everyday_profile is in the blacklist, but it doesn't work.

# this doesn't work
firejail --whitelist="$HOME/.mozilla/firefox/firejailed_profile" --blacklist="$HOME/.mozilla/firefox/*" firefox

Unfortunately, when I execute the above command, firefox can't find any firefox profile.

How can I fix the firejail command above, such that the whitelist has priority over the blacklist (so the child directory is in the whitelist and its parent directory is in the blacklist)?