What is Firejail?
FireJail is a terminal-based software that allows you to run programs in a sandboxed environment, similar to Windows’ “Sandbox” program. This type of environment ensures that an application operates in a safe zone, preventing it from affecting your current configuration and allowing you to observe its behaviour.
It is particularly useful when you do not trust the author of a certain software or script downloaded online, providing an extra layer of security.
Why Should You Use It?
- Lightweight.
- Isolate programs and scripts from the system.
- Protect you against virus & malicious software by running them in contained environment.
- FireJail can restrict access to network, files & hardware such as microphone and cameras.
How to Install FireJail
Use the following commands to install FireJail on your Linux distro.
Debian/Mint/Ubuntu
sudo apt install firejail
Arch/Manjaro
sudo pacman -S firejail
Fedora
sudo dnf install firejail
Make Sure It Works
After installation, you can check FireJail version using the command below :
firejail --version
Now we know it works!
How to Use FireJail
Using FireJail is fairly simple, just open a terminal and type the following :
firejail program
Example :
firejail firefox

Alright cool! We can run Firefox in a contained environment, but what about adding some options?
Use FireJail With Network Disabled
Use this command to launch a program with the network disabled :
firejail --net=none google-chrome-stable


Allow Access to Only One Directory
This command allows the program to access only a specific directory and restricts access to other files.
firejail --private=/home/user/mydir firefox
This command allows Firefox to access only the ‘mydir’ folder.
Remove Access to Home Directory
This command blocks access to your home directory.
firejail --private-home firefox
Run Your Program Without Audio Access
This command will block Firefox access to your audio system.
firejail --no-audio firefox
Disable Audio & Video Access
This command will disable all access to audio and video device (camera & microphone).
firejail --no-sound --no-video firefox
Limit The System Resources
This command allows you to set a custom CPU % and a custom memory size
firejail --cpu=50% --memory=512M firefox
Firefox will now be restricted to 50% of the CPU and 1 GB of RAM.
Leave a Reply