Some of the programs you run every day do not need to see your whole home directory, your SSH keys, or your network. Firejail is a sandbox that takes those permissions away one app at a time, using the same Linux kernel features containers are built on, without asking you to write a container. It is a practical, verifiable way to shrink your attack surface on Ubuntu, Debian, Fedora and Arch.
Everything here is checkable on your own machine in a few minutes, and nothing requires a server or a cloud account.
What Firejail actually does
Firejail is a SUID program that launches another program inside a restricted environment built from Linux namespaces (mount, PID, network, user) plus a seccomp-bpf filter that limits which system calls the program may make. In plain terms: it can hide files, cut the network, drop privileges and block dangerous syscalls — per application, from a single command.
It is not a virtual machine and not a full container. It is a lightweight wrapper, and that is exactly why it is useful for everyday apps that would be overkill to containerise.
1. Install it
# Ubuntu / Debian
sudo apt install firejail firejail-profiles
# Fedora
sudo dnf install firejail
# Arch / CachyOS
sudo pacman -S firejail
Firejail ships profiles for hundreds of common programs — browsers, media players, office apps — in /etc/firejail/.
2. Sandbox one application
The simplest use is to prefix the command:
firejail firefox
firejail thunderbird
firejail /path/to/some/app
Firejail loads the matching profile automatically if one exists. Nothing else about how you use the app changes.
Captura: la ventana de Firefox se abre igual que siempre, pero la salida de firejail en la terminal muestra las capas de sandbox que se han aplicado.
3. See what is running
firejail --list # active sandboxes
firejail --tree # process tree
firejail --top # like top, sandboxed processes only
If --list shows your app, the sandbox is live and you are not just looking at a normal launch.
4. Tighten it with options
Profiles are a starting point; these flags let you close specific doors:
firejail --net=none firefox # no network at all
firejail --net=eth0 app # only this interface
firejail --private app # throwaway home directory
firejail --private=/tmp/work app # private home backed by a folder
firejail --caps.drop=all app # drop every capability
firejail --nonewprivs app # forbid gaining new privileges
firejail --nodbus app # no D-Bus access
firejail --read-only=~/secrets app # hide a path from the app
For an app you truly do not trust — a random binary, a game mod tool downloaded from a forum — --private plus --net=none is a strong default: it cannot read your files and it cannot phone home.
5. Make it automatic with firecfg
Typing firejail every time is easy to forget. firecfg rewrites the desktop entries and shell paths so apps launch sandboxed by default:
sudo firecfg
It creates symlinks in /usr/local/bin for every program that has a profile. To undo it, run sudo firecfg --clean. Review the list it prints before you commit — a few apps genuinely break under their profile and you will want to exclude them.
6. Write a profile for your own app
Profiles are plain text in /etc/firejail/. A minimal one looks like this:
# /etc/firejail/myapp.profile
noblacklist ~/.config/myapp
include /etc/firejail/default.profile
private-tmp
caps.drop all
seccomp
Start from the shipped default.profile and add only what the app needs. Test with firejail --debug myapp to see exactly why something is being denied, rather than guessing.
Caveats worth knowing
- Firejail is SUID. That is what makes it powerful, and it means its own attack surface matters; keep it updated with the rest of your packages.
- Some apps need tweaks. Browsers with hardware acceleration, apps that lean on D-Bus, or anything that shells out to a helper may need profile adjustments.
- It is not Flatpak or a container. Flatpak sandboxes by packaging, containers isolate services. Firejail is the quickest way to sandbox a program you already have installed.
What changes for you
The value of a sandbox is not that it makes you bulletproof — it is that it contains the blast radius. If the PDF viewer you never trusted, or the game tool you grabbed off a forum, turns out to be hostile, Firejail means it cannot read your SSH keys or open a connection out. Start with one app you are unsure about, check firejail --list to confirm it is contained, and expand from there. That is a habit worth having, and it costs you a package install and one prefix word. If you want the deeper version, the shipped profiles are readable documentation of how each app is normally used — start there before writing anything of your own.





Leave a Reply