.TH FIREJAIL 1 "MONTH YEAR" "VERSION" "firejail man page" .SH NAME Firejail \- Linux namespaces sandbox program .SH SYNOPSIS Start a sandbox: .PP .RS firejail [OPTIONS] [program and arguments] .RE .PP File transfer from an existing sandbox .PP .RS firejail {\-\-ls | \-\-get} dir_or_filename .RE .PP Network traffic shaping for an existing sandbox: .PP .RS firejail \-\-bandwidth={name|pid} bandwidth-command .RE .PP Monitoring: .PP .RS firejail {\-\-list | \-\-netstats | \-\-top | \-\-tree} .RE .PP Miscellaneous: .PP .RS firejail {\-? | \-\-debug-caps | \-\-debug-errnos | \-\-debug-syscalls | \-\-debug-protocols | \-\-help | \-\-version} .RE .SH DESCRIPTION Firejail is a SUID sandbox program that reduces the risk of security breaches by restricting the running environment of untrusted applications using Linux namespaces, seccomp-bpf and Linux capabilities. It allows a process and all its descendants to have their own private view of the globally shared kernel resources, such as the network stack, process table, mount table. Firejail can work in a SELinux or AppArmor environment, and it is integrated with Linux Control Groups. .PP Written in C with virtually no dependencies, the software runs on any Linux computer with a 3.x kernel version or newer. It can sandbox any type of processes: servers, graphical applications, and even user login sessions. .PP Firejail allows the user to manage application security using security profiles. Each profile defines a set of permissions for a specific application or group of applications. The software includes security profiles for a number of more common Linux programs, such as Mozilla Firefox, Chromium, VLC, Transmission etc. .SH USAGE Without any options, the sandbox consists of a filesystem build in a new mount namespace, and new PID and UTS namespaces. IPC, network and user namespaces can be added using the command line options. The default Firejail filesystem is based on the host filesystem with the main system directories mounted read-only. These directories are /etc, /var, /usr, /bin, /sbin, /lib, /lib32, /libx32 and /lib64. Only /home and /tmp are writable. .PP As it starts up, Firejail tries to find a security profile based on the name of the application. If an appropriate profile is not found, Firejail will use a default profile. The default profile is quite restrictive. In case the application doesn't work, use --noprofile option to disable it. For more information, please see \fBSECURITY PROFILES\fR section below. .PP If a program argument is not specified, Firejail starts /bin/bash shell. Examples: .PP $ firejail [OPTIONS] # starting a /bin/bash shell .PP $ firejail [OPTIONS] firefox # starting Mozilla Firefox .PP # sudo firejail [OPTIONS] /etc/init.d/nginx start .SH OPTIONS .TP \fB\-\- Signal the end of options and disables further option processing. .TP \fB\-\-bandwidth=name|pid Set bandwidth limits for the sandbox identified by name or PID, see \fBTRAFFIC SHAPING\fR section for more details. .TP \fB\-\-bind=filename1,filename2 Mount-bind filename1 on top of filename2. This option is only available when running as root. .br .br Example: .br # firejail \-\-bind=/config/etc/passwd,/etc/passwd .TP \fB\-\-blacklist=dirname_or_filename Blacklist directory or file. .br .br Example: .br $ firejail \-\-blacklist=/sbin \-\-blacklist=/usr/sbin .br $ firejail \-\-blacklist=~/.mozilla .br $ firejail "\-\-blacklist=/home/username/My Virtual Machines" .br $ firejail \-\-blacklist=/home/username/My\\ Virtual\\ Machines .TP \fB\-c Execute command and exit. .TP \fB\-\-caps Linux capabilities is a kernel feature designed to split up the root privilege into a set of distinct privileges. These privileges can be enabled or disabled independently, thus restricting what a process running as root can do in the system. By default root programs run with all capabilities enabled. \-\-caps option disables the following capabilities: CAP_SYS_MODULE, CAP_SYS_RAWIO, CAP_SYS_BOOT, CAP_SYS_NICE, CAP_SYS_TTY_CONFIG, CAP_SYSLOG, CAP_MKNOD, CAP_SYS_ADMIN. The filter is applied to all processes started in the sandbox. .br .br Example: .br $ sudo firejail \-\-caps /etc/init.d/nginx start .TP \fB\-\-caps.drop=all Drop all capabilities for the processes running in the sandbox. This option is recommended for running GUI programs or any other program that doesn't require root privileges. It is a must-have option for sandboxing untrusted programs installed from unofficial sources - such as games, Java programs, etc. .br .br Example: .br $ firejail \-\-caps.drop=all warzone2100 .TP \fB\-\-caps.drop=capability,capability,capability Define a custom blacklist Linux capabilities filter. .br .br Example: .br $ firejail \-\-caps.keep=net_broadcast,net_admin,net_raw .TP \fB\-\-caps.keep=capability,capability,capability Define a custom whitelist Linux capabilities filter. .br .br Example: .br $ sudo firejail \-\-caps.keep=chown,net_bind_service,setgid,\\ setuid /etc/init.d/nginx start .br .br A short note about mixing \-\-whitelist and \-\-read-only options. Whitelisted directories should be made read-only independently. Making a parent directory read-only, will not make the whitelist read-only. Example: .br $ firejail --whitelist=~/work --read-only=~/ --read-only=~/work .TP \fB\-\-caps.print=name|pid Print the caps filter for the sandbox identified by name or by PID. .br .br Example: .br $ firejail \-\-name=mygame \-\-caps.drop=all warzone2100 & .br $ firejail \-\-caps.print=mygame .br .br Example: .br $ firejail \-\-list .br 3272:netblue:firejail \-\-private firefox .br $ firejail \-\-caps.print=3272 .TP \fB\-\-cgroup=tasks-file Place the sandbox in the specified control group. tasks-file is the full path of cgroup tasks file. .br .br Example: .br # firejail \-\-cgroup=/sys/fs/cgroup/g1/tasks .TP \fB\-\-chroot=dirname Chroot the sandbox into a root filesystem. Unlike the regular filesystem container, the system directories are mounted read-write. If the sandbox is started as a regular user, default seccomp and capabilities filters are enabled. This option is not available on Grsecurity systems. .br .br Example: .br $ firejail \-\-chroot=/media/ubuntu warzone2100 .TP \fB\-\-cpu=cpu-number,cpu-number,cpu-number Set CPU affinity. .br .br Example: .br $ firejail \-\-cpu=0,1 handbrake .TP \fB\-\-cpu.print=name|pid Print the CPU cores in use by the sandbox identified by name or by PID. .br .br Example: .br $ firejail \-\-name=mygame \-\-caps.drop=all warzone2100 & .br $ firejail \-\-cpu.print=mygame .br .br Example: .br $ firejail \-\-list .br 3272:netblue:firejail \-\-private firefox .br $ firejail \-\-cpu.print=3272 .TP \fB\-\-csh Use /bin/csh as default user shell. .br .br Example: .br $ firejail \-\-csh .TP \fB\-\-debug\fR Print debug messages. .br .br Example: .br $ firejail \-\-debug firefox .TP \fB\-\-debug-blacklists\fR Debug blacklisting. .br .br Example: .br $ firejail \-\-debug-blacklists firefox .TP \fB\-\-debug-caps Print all recognized capabilities in the current Firejail software build and exit. .br .br Example: .br $ firejail \-\-debug-caps .TP \fB\-\-debug-check-filename\fR Debug filename checking. .br .br Example: .br $ firejail \-\-debug-check-filename firefox .TP \fB\-\-debug-errnos Print all recognized error numbers in the current Firejail software build and exit. .br .br Example: .br $ firejail \-\-debug-errnos .TP \fB\-\-debug-protocols Print all recognized protocols in the current Firejail software build and exit. .br .br Example: .br $ firejail \-\-debug-protocols .TP \fB\-\-debug-syscalls Print all recognized system calls in the current Firejail software build and exit. .br .br Example: .br $ firejail \-\-debug-syscalls .TP \fB\-\-debug-whitelists\fR Debug whitelisting. .br .br Example: .br $ firejail \-\-debug-whitelists firefox .TP \fB\-\-defaultgw=address Use this address as default gateway in the new network namespace. .br .br Example: .br $ firejail \-\-net=eth0 \-\-defaultgw=10.10.20.1 firefox .TP \fB\-\-dns=address Set a DNS server for the sandbox. Up to three DNS servers can be defined. Use this option if you don't trust the DNS setup on your network. .br .br Example: .br $ firejail \-\-dns=8.8.8.8 \-\-dns=8.8.4.4 firefox .TP \fB\-\-dns.print=name|pid Print DNS configuration for a sandbox identified by name or by PID. .br .br Example: .br $ firejail \-\-name=mygame \-\-caps.drop=all warzone2100 & .br $ firejail \-\-dns.print=mygame .br .br Example: .br $ firejail \-\-list .br 3272:netblue:firejail \-\-private firefox .br $ firejail \-\-dns.print=3272 .TP \fB\-\-env=name=value Set environment variable in the new sandbox. .br .br Example: .br $ firejail \-\-env=LD_LIBRARY_PATH=/opt/test/lib .TP \fB\-\-force By default, if Firejail is started in an existing sandbox, it will run the program in a bash shell. This option disables this behavior, and attempts to start Firejail in the existing sandbox. There could be lots of reasons for it to fail, for example if the existing sandbox disables admin capabilities, SUID binaries, or if it runs seccomp. .TP \fB\-\-fs.print=name|print Print the filesystem log for the sandbox identified by name or by PID. .br .br Example: .br $ firejail \-\-name=mygame \-\-caps.drop=all warzone2100 & .br $ firejail \-\-fs.print=mygame .br .br Example: .br $ firejail \-\-list .br 3272:netblue:firejail \-\-private firefox .br $ firejail \-\-fs.print=3272 .TP \fB\-\-get=name|pid filename Get a file from sandbox container, see \fBFILE TRANSFER\fR section for more details. .TP \fB\-?\fR, \fB\-\-help\fR Print options end exit. .TP \fB\-\-hostname=name Set sandbox hostname. .br .br Example: .br $ firejail \-\-hostname=officepc firefox .TP \fB\-\-ignore=command Ignore command in profile file. .br .br Example: .br $ firejail \-\-ignore=shell --ignore=seccomp firefox .TP \fB\-\-interface=interface Move interface in a new network namespace. Up to four --interface options can be specified. Note: wlan devices are not supported for this option. .br .br Example: .br $ firejail \-\-interface=eth1 \-\-interface=eth0.vlan100 .TP \fB\-\-ip=address Assign IP addresses to the last network interface defined by a \-\-net option. A default gateway is assigned by default. .br .br Example: .br $ firejail \-\-net=eth0 \-\-ip=10.10.20.56 firefox .TP \fB\-\-ip=none No IP address and no default gateway are configured for the last interface defined by a \-\-net option. Use this option in case you intend to start an external DHCP client in the sandbox. .br .br Example: .br $ firejail \-\-net=eth0 \-\-\ip=none .TP \fB\-\-ip6=address Assign IPv6 addresses to the last network interface defined by a \-\-net option. .br .br Example: .br $ firejail \-\-net=eth0 \-\-ip6=2001:0db8:0:f101::1/64 firefox Note: you don't need this option if you obtain your ip6 address from router via SLAAC (your ip6 address and default route will be configured by kernel automatically). .TP \fB\-\-iprange=address,address Assign an IP address in the provided range to the last network interface defined by a \-\-net option. A default gateway is assigned by default. .br .br Example: .br $ firejail \-\-net=eth0 \-\-\iprange=192.168.1.100,192.168.1.150 .TP \fB\-\-ipc-namespace Enable a new IPC namespace if the sandbox was started as a regular user. IPC namespace is enabled by default for sandboxes started as root. .br .br Example: .br $ firejail \-\-ipc-namespace firefox .TP \fB\-\-join=name|pid Join the sandbox identified by name or by PID. By default a /bin/bash shell is started after joining the sandbox. If a program is specified, the program is run in the sandbox. If \-\-join command is issued as a regular user, all security filters are configured for the new process the same they are configured in the sandbox. If \-\-join command is issued as root, the security filters, cgroups and cpus configurations are not applied to the process joining the sandbox. .br .br Example: .br $ firejail \-\-name=mygame \-\-caps.drop=all warzone2100 & .br $ firejail \-\-join=mygame .br .br Example: .br $ firejail \-\-list .br 3272:netblue:firejail \-\-private firefox .br $ firejail \-\-join=3272 .TP \fB\-\-join-filesystem=name|pid Join the mount namespace of the sandbox identified by name or PID. By default a /bin/bash shell is started after joining the sandbox. If a program is specified, the program is run in the sandbox. This command is available only to root user. Security filters, cgroups and cpus configurations are not applied to the process joining the sandbox. .TP \fB\-\-join-network=name|PID Join the network namespace of the sandbox identified by name. By default a /bin/bash shell is started after joining the sandbox. If a program is specified, the program is run in the sandbox. This command is available only to root user. Security filters, cgroups and cpus configurations are not applied to the process joining the sandbox. Example: .br .br # start firefox .br $ firejail --net=eth0 --name=browser firefox & .br .br # change netfilter configuration .br $ sudo firejail --join-network=browser "cat /etc/firejail/nolocal.net | /sbin/iptables-restore" .br .br # verify netfilter configuration .br $ sudo firejail --join-network=browser "/sbin/iptables -vL" .br .br # verify IP addresses .br $ sudo firejail --join-network=browser "ip addr" .br Switching to pid 1932, the first child process inside the sandbox .br 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default .br link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 .br inet 127.0.0.1/8 scope host lo .br valid_lft forever preferred_lft forever .br inet6 ::1/128 scope host .br valid_lft forever preferred_lft forever .br 2: eth0-1931: mtu 1500 qdisc noqueue state UNKNOWN group default .br link/ether 76:58:14:42:78:e4 brd ff:ff:ff:ff:ff:ff .br inet 192.168.1.158/24 brd 192.168.1.255 scope global eth0-1931 .br valid_lft forever preferred_lft forever .br inet6 fe80::7458:14ff:fe42:78e4/64 scope link .br valid_lft forever preferred_lft forever .TP \fB\-\-ls=name|pid dir_or_filename List files in sandbox container, see \fBFILE TRANSFER\fR section for more details. .TP \fB\-\-list List all sandboxes, see \fBMONITORING\fR section for more details. .br .br Example: .br $ firejail \-\-list .br 7015:netblue:firejail firefox .br 7056:netblue:firejail \-\-net=eth0 transmission-gtk .br 7064:netblue:firejail \-\-noroot xterm .br $ .TP \fB\-\-mac=address Assign MAC addresses to the last network interface defined by a \-\-net option. .br .br Example: .br $ firejail \-\-net=eth0 \-\-mac=00:11:22:33:44:55 firefox .TP \fB\-\-mtu=number Assign a MTU value to the last network interface defined by a \-\-net option. .br .br Example: .br $ firejail \-\-net=eth0 \-\-mtu=1492 .TP \fB\-\-name=name Set sandbox name. Several options, such as \-\-join and \-\-shutdown, can use this name to identify a sandbox. .br .br Example: .br $ firejail \-\-name=mybrowser firefox .TP \fB\-\-net=bridge_interface Enable a new network namespace and connect it to this bridge interface. Unless specified with option \-\-ip and \-\-defaultgw, an IP address and a default gateway will be assigned automatically to the sandbox. The IP address is verified using ARP before assignment. The address configured as default gateway is the bridge device IP address. Up to four \-\-net bridge devices can be defined. Mixing bridge and macvlan devices is allowed. .br .br Example: .br $ sudo brctl addbr br0 .br $ sudo ifconfig br0 10.10.20.1/24 .br $ sudo brctl addbr br1 .br $ sudo ifconfig br1 10.10.30.1/24 .br $ firejail \-\-net=br0 \-\-net=br1 .TP \fB\-\-net=ethernet_interface Enable a new network namespace and connect it to this ethernet interface using the standard Linux macvlan driver. Unless specified with option \-\-ip and \-\-defaultgw, an IP address and a default gateway will be assigned automatically to the sandbox. The IP address is verified using ARP before assignment. The address configured as default gateway is the default gateway of the host. Up to four \-\-net devices can be defined. Mixing bridge and macvlan devices is allowed. Note: wlan devices are not supported for this option. .br .br Example: .br $ firejail \-\-net=eth0 \-\-ip=192.168.1.80 \-\-dns=8.8.8.8 firefox .TP \fB\-\-net=none Enable a new, unconnected network namespace. The only interface available in the new namespace is a new loopback interface (lo). Use this option to deny network access to programs that don't really need network access. .br .br Example: .br $ firejail \-\-net=none vlc .TP \fB\-\-netfilter Enable a default client network filter in the new network namespace. New network namespaces are created using \-\-net option. If a new network namespaces is not created, \-\-netfilter option does nothing. The default filter is as follows: .br .br *filter .br :INPUT DROP [0:0] .br :FORWARD DROP [0:0] .br :OUTPUT ACCEPT [0:0] .br \-A INPUT \-i lo \-j ACCEPT .br \-A INPUT \-m state \-\-state RELATED,ESTABLISHED \-j ACCEPT .br # allow ping .br \-A INPUT \-p icmp \-\-icmp-type destination-unreachable \-j ACCEPT .br \-A INPUT \-p icmp \-\-icmp-type time-exceeded \-j ACCEPT .br \-A INPUT \-p icmp \-\-icmp-type echo-request \-j ACCEPT .br # drop STUN (WebRTC) requests .br -A OUTPUT -p udp --dport 3478 -j DROP .br -A OUTPUT -p udp --dport 3479 -j DROP .br -A OUTPUT -p tcp --dport 3478 -j DROP .br -A OUTPUT -p tcp --dport 3479 -j DROP .br COMMIT .br .br Example: .br $ firejail \-\-net=eth0 \-\-netfilter firefox .TP \fB\-\-netfilter=filename Enable the network filter specified by filename in the new network namespace. The filter file format is the format of iptables-save and iptable-restore commands. New network namespaces are created using \-\-net option. If a new network namespaces is not created, \-\-netfilter option does nothing. .br .br The following filters are available in /etc/firejail directory: .br .br .B webserver.net is a webserver filter that allows access only to TCP ports 80 and 443. Example: .br .br $ firejail --netfilter=/etc/firejail/webserver.net --net=eth0 \\ .br /etc/init.d/apache2 start .br .br .B nolocal.net is a client filter that disable access to local network. Example: .br .br $ firejail --netfilter=/etc/firejail/nolocal.net \\ .br --net=eth0 firefox .TP \fB\-\-netfilter6=filename Enable the IPv6 network filter specified by filename in the new network namespace. The filter file format is the format of ip6tables-save and ip6table-restore commands. New network namespaces are created using \-\-net option. If a new network namespaces is not created, \-\-netfilter6 option does nothing. .TP \fB\-\-netstats Monitor network namespace statistics, see \fBMONITORING\fR section for more details. .br .br Example: .br .br $ firejail \-\-netstats .br PID User RX(KB/s) TX(KB/s) Command .br 1294 netblue 53.355 1.473 firejail \-\-net=eth0 firefox .br 7383 netblue 9.045 0.112 firejail \-\-net=eth0 transmission .TP \fB\-\-nice=value Set nice value for all processes running inside the sandbox. .br .br Example: .br $ firejail --nice=-5 firefox .TP \fB\-\-noblacklist=dirname_or_filename Disable blacklist for this directory or file. .br .br Example: .br $ firejail .br $ nc dict.org 2628 .br bash: /bin/nc: Permission denied .br $ exit .br .br $ firejail --noblacklist=/bin/nc .br $ nc dict.org 2628 .br 220 pan.alephnull.com dictd 1.12.1/rf on Linux 3.14-1-amd64 .br .TP \fB\-\-nogroups Disable supplementary groups. Without this option, supplementary groups are enabled for the user starting the sandbox. For root user supplementary groups are always disabled. .br .br Example: .br $ id .br uid=1000(netblue) gid=1000(netblue) groups=1000(netblue),24(cdrom),25(floppy),27(sudo),29(audio) .br $ firejail \-\-nogroups .br Parent pid 8704, child pid 8705 .br Child process initialized .br $ id .br uid=1000(netblue) gid=1000(netblue) groups=1000(netblue) .br $ .TP \fB\-\-noprofile Do not use a security profile. .br .br Example: .br $ firejail .br Reading profile /etc/firejail/generic.profile .br Parent pid 8553, child pid 8554 .br Child process initialized .br [...] .br .br $ firejail \-\-noprofile .br Parent pid 8553, child pid 8554 .br Child process initialized .br [...] .TP \fB\-\-noroot Install a user namespace with a single user - the current user. root user does not exist in the new namespace. This option requires a Linux kernel version 3.8 or newer. The option is not supported for \-\-chroot and \-\-overlay configurations, or for sandboxes started as root. .br .br Example: .br $ firejail \-\-noroot .br Parent pid 8553, child pid 8554 .br Child process initialized .br $ ping google.com .br ping: icmp open socket: Operation not permitted .br $ .TP \fB\-\-nosound Disable sound system. .br .br Example: .br $ firejail \-\-nosound firefox .TP \fB\-\-output=logfile stdout logging and log rotation. Copy stdout and stderr to logfile, and keep the size of the file under 500KB using log rotation. Five files with prefixes .1 to .5 are used in rotation. .br .br Example: .br $ firejail \-\-output=sandboxlog /bin/bash .br [...] .br $ ls -l sandboxlog* .br -rw-r--r-- 1 netblue netblue 333890 Jun 2 07:48 sandboxlog .br -rw-r--r-- 1 netblue netblue 511488 Jun 2 07:48 sandboxlog.1 .br -rw-r--r-- 1 netblue netblue 511488 Jun 2 07:48 sandboxlog.2 .br -rw-r--r-- 1 netblue netblue 511488 Jun 2 07:48 sandboxlog.3 .br -rw-r--r-- 1 netblue netblue 511488 Jun 2 07:48 sandboxlog.4 .br -rw-r--r-- 1 netblue netblue 511488 Jun 2 07:48 sandboxlog.5 .TP \fB\-\-overlay Mount a filesystem overlay on top of the current filesystem. Unlike the regular filesystem container, the system directories are mounted read-write. All filesystem modifications go into the overlay. The overlay is stored in $HOME/.firejail directory. This option is not available on Grsecurity systems. .br .br OverlayFS support is required in Linux kernel for this option to work. OverlayFS was officially introduced in Linux kernel version 3.18 .br .br Example: .br $ firejail \-\-overlay firefox .TP \fB\-\-overlay-tmpfs Mount a filesystem overlay on top of the current filesystem. All filesystem modifications go into the overlay, and are discarded when the sandbox is closed. This option is not available on Grsecurity systems. .br .br OverlayFS support is required in Linux kernel for this option to work. OverlayFS was officially introduced in Linux kernel version 3.18 .br .br Example: .br $ firejail \-\-overlay-tmpfs firefox .TP \fB\-\-private Mount new /root and /home/user directories in temporary filesystems. All modifications are discarded when the sandbox is closed. .br .br Example: .br $ firejail \-\-private firefox .TP \fB\-\-private=directory Use directory as user home. .br .br Example: .br $ firejail \-\-private=/home/netblue/firefox-home firefox .TP \fB\-\-private-bin=file,file Build a new /bin in a temporary filesystem, and copy the programs in the list. The same directory is also bind-mounted over /sbin, /usr/bin, /usr/sbin and /usr/local/bin. .br .br Example: .br $ firejail \-\-private-bin=bash,sed,ls,cat .br Parent pid 20841, child pid 20842 .br Child process initialized .br $ ls /bin .br bash cat ls sed .TP \fB\-\-private-dev Create a new /dev directory. Only dri, null, full, zero, tty, pts, ptmx, random, urandom, log and shm devices are available. .br .br Example: .br $ firejail \-\-private-dev .br Parent pid 9887, child pid 9888 .br Child process initialized .br $ ls /dev .br dri full log null ptmx pts random shm tty urandom zero .br $ .TP \fB\-\-private-etc=file,directory Build a new /etc in a temporary filesystem, and copy the files and directories in the list. All modifications are discarded when the sandbox is closed. .br .br Example: .br $ firejail --private-etc=group,hostname,localtime, \\ .br nsswitch.conf,passwd,resolv.conf .TP \fB\-\-private-tmp Mount an empty temporary filesystem on top of /tmp directory. .br .br Example: .br $ firejail \-\-private-tmp .TP \fB\-\-profile=filename Load a custom security profile from filename. For filename use an absolute path or a path relative to the current path. For more information, see \fBSECURITY PROFILES\fR section below. .br .br Example: .br $ firejail \-\-profile=myprofile .TP \fB\-\-profile-path=directory Use this directory to look for profile files. Use an absolute path or a path in the home directory starting with ~/. For more information, see \fBSECURITY PROFILES\fR section below and \fBRELOCATING PROFILE FILES\fR in \fBman 5 firejail-profile\fR. .br .br Example: .br $ firejail \-\-profile-path=~/myprofiles .br $ firejail \-\-profile-path=/home/netblue/myprofiles .TP \fB\-\-protocol=protocol,protocol,protocol Enable protocol filter. The filter is based on seccomp and checks the first argument to socket system call. Recognized values: unix, inet, inet6, netlink and packet. This option is not supported for i386 architecture. .br .br Example: .br $ firejail \-\-protocol=unix,inet,inet6 firefox .TP \fB\-\-protocol.print=name|pid Print the protocol filter for the sandbox identified by name or PID. .br .br Example: .br $ firejail \-\-name=mybrowser firefox & .br $ firejail \-\-protocol.print=mybrowser .br unix,inet,inet6,netlink .br .br Example: .br $ firejail \-\-list .br 3272:netblue:firejail \-\-private firefox .br $ firejail \-\-protocol.print=3272 .br unix,inet,inet6,netlink .TP \fB\-\-quiet Turn off Firejail's output. .TP \fB\-\-read-only=dirname_or_filename Set directory or file read-only. .br .br Example: .br $ firejail \-\-read-only=~/.mozilla firefox .TP \fB\-\-rlimit-fsize=number Set the maximum file size that can be created by a process. .TP \fB\-\-rlimit-nofile=number Set the maximum number of files that can be opened by a process. .TP \fB\-\-rlimit-nproc=number Set the maximum number of processes that can be created for the real user ID of the calling process. .TP \fB\-\-rlimit-sigpending=number Set the maximum number of pending signals for a process. .TP \fB\-\-read-write=dirname_or_filename By default, the sandbox mounts system directories read-only. These directories are /etc, /var, /usr, /bin, /sbin, /lib, /lib32, /libx32 and /lib64. Use this option to mount read-write files or directories inside the system directories. This option is available only to root user. It has no effect when --chroot or --overlay are also set. In these cases the system directories are mounted read-write. .TP \fB\-\-scan ARP-scan all the networks from inside a network namespace. This makes it possible to detect macvlan kernel device drivers running on the current host. .br .br Example: .br $ firejail \-\-net=eth0 \-\-scan .TP \fB\-\-seccomp Enable seccomp filter and blacklist the syscalls in the default list. The default list is as follows: mount, umount2, ptrace, kexec_load, kexec_file_load, open_by_handle_at, init_module, finit_module, delete_module, iopl, ioperm, swapon, swapoff, syslog, process_vm_readv, process_vm_writev, sysfs,_sysctl, adjtimex, clock_adjtime, lookup_dcookie, perf_event_open, fanotify_init, kcmp, add_key, request_key, keyctl, uselib, acct, modify_ldt, pivot_root, io_setup, io_destroy, io_getevents, io_submit, io_cancel, remap_file_pages, mbind, get_mempolicy, set_mempolicy, migrate_pages, move_pages, vmsplice, perf_event_open, chroot, tuxcall, reboot, mfsservctl and get_kernel_syms. .br .br System architecture is not strictly imposed. The filter is applied at run time only if the correct architecture was detected. For the case of I386 and AMD64 both 32-bit and 64-bit filters are installed. .br .br Example: .br $ firejail \-\-seccomp .TP \fB\-\-seccomp=syscall,syscall,syscall Enable seccomp filter, blacklist the default list and the syscalls specified by the command. .br .br Example: .br $ firejail \-\-seccomp=utime,utimensat,utimes firefox .TP \fB\-\-seccomp.drop=syscall,syscall,syscall Enable seccomp filter, and blacklist the syscalls specified by the command. .br .br Example: .br $ firejail \-\-seccomp.drop=utime,utimensat,utimes .TP \fB\-\-seccomp.keep=syscall,syscall,syscall Enable seccomp filter, and whitelist the syscalls specified by the command. .br .br Example: .br $ firejail \-\-shell=none \-\-seccomp.keep=poll,select,[...] transmission-gtk .TP \fB\-\-seccomp.=syscall,syscall,syscall Enable seccomp filter, and return errno for the syscalls specified by the command. .br .br Example: a Bash shell where deleting files is disabled .br .br $ firejail --seccomp.eperm=unlinkat .br Parent pid 10662, child pid 10663 .br Child process initialized .br $ touch testfile .br $ rm testfile .br rm: cannot remove `testfile': Operation not permitted .TP \fB\-\-seccomp.print=name|PID Print the seccomp filter for the sandbox identified by name or PID. .br .br Example: .br $ firejail \-\-name=browser firefox & .br $ firejail \-\-seccomp.print=browser .br SECCOMP Filter: .br VALIDATE_ARCHITECTURE .br EXAMINE_SYSCALL .br BLACKLIST 165 mount .br BLACKLIST 166 umount2 .br BLACKLIST 101 ptrace .br BLACKLIST 246 kexec_load .br BLACKLIST 304 open_by_handle_at .br BLACKLIST 175 init_module .br BLACKLIST 176 delete_module .br BLACKLIST 172 iopl .br BLACKLIST 173 ioperm .br BLACKLIST 167 swapon .br BLACKLIST 168 swapoff .br BLACKLIST 103 syslog .br BLACKLIST 310 process_vm_readv .br BLACKLIST 311 process_vm_writev .br BLACKLIST 133 mknod .br BLACKLIST 139 sysfs .br BLACKLIST 156 _sysctl .br BLACKLIST 159 adjtimex .br BLACKLIST 305 clock_adjtime .br BLACKLIST 212 lookup_dcookie .br BLACKLIST 298 perf_event_open .br BLACKLIST 300 fanotify_init .br RETURN_ALLOW .br $ .TP \fB\-\-shell=none Run the program directly, without a user shell. .br .br Example: .br $ firejail \-\-shell=none script.sh .TP \fB\-\-shell=program Set default user shell. Use this shell to run the application using \-c shell option. For example "firejail \-\-shell=/bin/dash firefox" will start Mozilla Firefox as "/bin/dash \-c firefox". By default Bash shell (/bin/bash) is used. Options such as \-\-zsh and \-\-csh can also set the default shell. .br .br Example: $firejail \-\-shell=/bin/dash script.sh .TP \fB\-\-shutdown=name|PID Shutdown the sandbox identified by name or PID. .br .br Example: .br $ firejail \-\-name=mygame \-\-caps.drop=all warzone2100 & .br $ firejail \-\-shutdown=mygame .br .br Example: .br $ firejail \-\-list .br 3272:netblue:firejail \-\-private firefox .br $ firejail \-\-shutdown=3272 .TP \fB\-\-tmpfs=dirname Mount a tmpfs filesystem on directory dirname. This option is available only when running the sandbox as root. .br .br Example: .br # firejail \-\-tmpfs=/var .TP \fB\-\-top Monitor the most CPU-intensive sandboxes, see \fBMONITORING\fR section for more details. .br .br Example: .br $ firejail \-\-top .TP \fB\-\-trace Trace open, access and connect system calls. .br .br Example: .br $ firejail \-\-trace wget -q www.debian.org .br Parent pid 11793, child pid 11794 .br Child process initialized .br 1:bash:open /dev/tty .br 1:wget:fopen64 /etc/wgetrc .br 1:wget:fopen /etc/hosts .br 1:wget:socket AF_INET SOCK_DGRAM IPPROTO_IP .br 1:wget:connect 8.8.8.8:53 .br 1:wget:socket AF_INET SOCK_STREAM IPPROTO_IP .br 1:wget:connect 140.211.15.34:80 .br 1:wget:fopen64 index.html.1 .br .br parent is shutting down, bye... .TP \fB\-\-tracelog This option enables auditing blacklisted files and directories. A message is sent to syslog in case the file or the directory is accessed. .br .br Example: .br $ firejail --tracelog firefox .br .br Sample messages: .br $ sudo tail -f /var/log/syslog .br [...] .br Dec 3 11:43:25 debian firejail[70]: blacklist violation - sandbox 26370, exe firefox, syscall open64, path /etc/shadow .br Dec 3 11:46:17 debian firejail[70]: blacklist violation - sandbox 26370, exe firefox, syscall opendir, path /boot .br [...] .TP \fB\-\-tree Print a tree of all sandboxed processes, see \fBMONITORING\fR section for more details. .br .br Example: .br $ firejail \-\-tree .br 11903:netblue:firejail iceweasel .br 11904:netblue:iceweasel .br 11957:netblue:/usr/lib/iceweasel/plugin-container .br 11969:netblue:firejail \-\-net=eth0 transmission-gtk .br 11970:netblue:transmission-gtk .TP \fB\-\-user=new-user Switch the user before starting the sandbox. This command should be run as root. .br .br Example: .br # firejail \-\-user=www-data .TP \fB\-\-version Print program version and exit. .br .br Example: .br $ firejail \-\-version .br firejail version 0.9.27 .TP \fB\-\-whitelist=dirname_or_filename Whitelist directory or file. This feature is implemented only for user home, /dev, /media, /opt, /var, and /tmp directories. When whitlisting symbolic links, both the link and the real file should be in the same top directory (home user, /media, /var etc.) .br .br Example: .br $ firejail \-\-whitelist=~/.mozilla \-\-whitelist=~/Downloads .br $ firejail \-\-whitelist=/tmp/.X11-unix --whitelist=/dev/null .br $ firejail "\-\-whitelist=/home/username/My Virtual Machines" .TP \fB\-\-writable-etc Mount /etc directory read-write. This option is available only when running the sandbox as root user. .br .br Example: .br $ sudo firejail --writable-etc .TP \fB\-\-writable-var Mount /var directory read-write. This option is available only when running the sandbox as root user. .br .br Example: .br $ sudo firejail --writable-var .TP \fB\-\-x11 Start a new X11 server using Xpra or Xephyr and attach the sandbox to this server. The regular X11 server (display 0) is not visible in the sandbox. This prevents screenshot and keylogger applications started in the sandbox from accessing other X11 displays. A network namespace needs to be instantiated in order to deny access to X11 abstract Unix domain socket. .br .br Firejail will try first Xpra, and if Xpra is not installed on the system, it will try to find Xephyr. This feature is not available when running as root. .br .br Example: .br $ firejail \-\-x11 --net=eth0 firefox .TP \fB\-\-x11=xpra Start a new X11 server using Xpra (http://xpra.org) and attach the sandbox to this server. Xpra is a persistent remote display server and client for forwarding X11 applications and desktop screens. On Debian platforms Xpra is installed with the command \fBsudo apt-get install xpra\fR. This feature is not available when running as root. .br .br Example: .br $ firejail \-\-x11=xpra --net=eth0 firefox .TP \fB\-\-x11=xephyr Start a new X11 server using Xephyr and attach the sandbox to this server. Xephyr is a display server implementing the X11 display server protocol. It runs in a window just like other X applications, but it is an X server itself in which you can run other software. The default Xephyr window size is 800x600. This can be modified in /etc/firejail/firejail.config file, see \fBman 5 firejail-config\fR for more details. .br .br The recommended way to use this feature is to run a window manager inside the sandbox. A security profile for OpenBox is provided. On Debian platforms Xephyr is installed with the command \fBsudo apt-get install xserver-xephyr\fR. This feature is not available when running as root. .br .br Example: .br $ firejail \-\-x11=xephyr --net=eth0 openbox .TP \fB\-\-zsh Use /usr/bin/zsh as default user shell. .br .br Example: .br $ firejail \-\-zsh .SH DESKTOP INTEGRATION A symbolic link to /usr/bin/firejail under the name of a program, will start the program in Firejail sandbox. The symbolic link should be placed in the first $PATH position. On most systems, a good place is /usr/local/bin directory. Example: .PP .RS .br .br Make a firefox symlink to /usr/bin/firejail: .br .br $ ln -s /usr/bin/firejail /usr/local/bin/firefox .br .br Verify $PATH .br .br $ which -a firefox .br /usr/local/bin/firefox .br /usr/bin/firefox .br .br Starting firefox in this moment, automatically invokes “firejail firefox”. .RE .br .br This works for clicking on desktop environment icons, menus etc. Use "firejail --tree" to verify the program is sandboxed. .PP .RS .br .br .br $ firejail --tree .br 1189:netblue:firejail firefox .br 1190:netblue:firejail firefox .br 1220:netblue:/bin/sh -c "/usr/lib/firefox/firefox" .br 1221:netblue:/usr/lib/firefox/firefox .RE .SH FILE TRANSFER These features allow the user to inspect the filesystem container of an existing sandbox and transfer files from the container to the host filesystem. .TP \fB\-\-get=name|pid filename Retrieve the container file and store it on the host in the current working directory. The container is specified by name or PID. Full path is needed for filename. .TP \fB\-\-ls=name|pid dir_or_filename List container files. The container is specified by name or PID. Full path is needed for dir_or_filename. .TP Examples: .br .br $ firejail \-\-name=mybrowser --private firefox .br .br $ firejail \-\-ls=mybrowser ~/Downloads .br drwxr-xr-x netblue netblue 4096 . .br drwxr-xr-x netblue netblue 4096 .. .br -rw-r--r-- netblue netblue 7847 x11-x305.png .br -rw-r--r-- netblue netblue 6800 x11-x642.png .br -rw-r--r-- netblue netblue 34139 xpra-clipboard.png .br .br $ firejail \-\-get=mybrowser ~/Downloads/xpra-clipboard.png .SH TRAFFIC SHAPING Network bandwidth is an expensive resource shared among all sandboxes running on a system. Traffic shaping allows the user to increase network performance by controlling the amount of data that flows into and out of the sandboxes. Firejail implements a simple rate-limiting shaper based on Linux command tc. The shaper works at sandbox level, and can be used only for sandboxes configured with new network namespaces. Set rate-limits: firejail --bandwidth=name|pid set network download upload Clear rate-limits: firejail --bandwidth=name|pid clear network Status: firejail --bandwidth=name|pid status where: .br name - sandbox name .br pid - sandbox pid .br network - network interface as used by \-\-net option .br download - download speed in KB/s (kilobyte per second) .br upload - upload speed in KB/s (kilobyte per second) Example: .br $ firejail \-\-name=mybrowser \-\-net=eth0 firefox & .br $ firejail \-\-bandwidth=mybrowser set eth0 80 20 .br $ firejail \-\-bandwidth=mybrowser status .br $ firejail \-\-bandwidth=mybrowser clear eth0 .SH MONITORING Option \-\-list prints a list of all sandboxes. The format for each process entry is as follows: PID:USER:Command Option \-\-tree prints the tree of processes running in the sandbox. The format for each process entry is as follows: PID:USER:Command Option \-\-top is similar to the UNIX top command, however it applies only to sandboxes. Option \-\-netstats prints network statistics for active sandboxes installing new network namespaces. Listed below are the available fields (columns) in alphabetical order for \-\-top and \-\-netstat options: .TP Command Command used to start the sandbox. .TP CPU% CPU usage, the sandbox share of the elapsed CPU time since the last screen update .TP PID Unique process ID for the task controlling the sandbox. .TP Prcs Number of processes running in sandbox, including the controlling process. .TP RES Resident Memory Size (KiB), sandbox non-swapped physical memory. It is a sum of the RES values for all processes running in the sandbox. .TP RX(KB/s) Network receive speed. .TP SHR Shared Memory Size (KiB), it reflects memory shared with other processes. It is a sum of the SHR values for all processes running in the sandbox, including the controlling process. .TP TX(KB/s) Network transmit speed. .TP Uptime Sandbox running time in hours:minutes:seconds format. .TP User The owner of the sandbox. .SH SECURITY PROFILES Several command line options can be passed to the program using profile files. Firejail chooses the profile file as follows: 1. If a profile file is provided by the user with --profile option, the profile file is loaded. Example: .PP .RS $ firejail --profile=/home/netblue/icecat.profile icecat .br Reading profile /home/netblue/icecat.profile .br [...] .RE 2. If a profile file with the same name as the application is present in ~/.config/firejail directory or in /etc/firejail, the profile is loaded. ~/.config/firejail takes precedence over /etc/firejail. Example: .PP .RS $ firejail icecat .br Command name #icecat# .br Found icecat profile in /home/netblue/.config/firejail directory .br Reading profile /home/netblue/.config/firejail/icecat.profile .br [...] .RE 3. Use default.profile file if the sandbox is started by a regular user, or server.profile file if the sandbox is started by root. Firejail looks for these files in ~/.config/firejail directory, followed by /etc/firejail directory. To disable default profile loading, use --noprofile command option. Example: .PP .RS $ firejail .br Reading profile /etc/firejail/generic.profile .br Parent pid 8553, child pid 8554 .br Child process initialized .br [...] .br .br $ firejail \-\-noprofile .br Parent pid 8553, child pid 8554 .br Child process initialized .br [...] .RE See man 5 firejail-profile for profile file syntax information. .SH RESTRICTED SHELL To configure a restricted shell, replace /bin/bash with /usr/bin/firejail in /etc/passwd file for each user that needs to be restricted. Alternatively, you can specify /usr/bin/firejail in adduser command: adduser \-\-shell /usr/bin/firejail username Additional arguments passed to firejail executable upon login are declared in /etc/firejail/login.users file. .SH EXAMPLES .TP \f\firejail Sandbox a regular /bin/bash session. .TP \f\firejail firefox Start Mozilla Firefox. .TP \f\firejail \-\-debug firefox Debug Firefox sandbox. .TP \f\firejail \-\-private firefox Start Firefox with a new, empty home directory. .TP \f\firejail --net=none vlc Start VLC in an unconnected network namespace. .TP \f\firejail \-\-net=eth0 firefox Start Firefox in a new network namespace. An IP address is assigned automatically. .TP \f\firejail \-\-net=br0 \-\-ip=10.10.20.5 \-\-net=br1 \-\-net=br2 Start a /bin/bash session in a new network namespace and connect it to br0, br1, and br2 host bridge devices. IP addresses are assigned automatically for the interfaces connected to br1 and b2 .TP \f\firejail \-\-list List all sandboxed processes. .SH LICENSE This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP Homepage: http://firejail.wordpress.com .SH SEE ALSO \&\flfiremon\fR\|(1), \&\flfirecfg\fR\|(1), \&\flfirejail-profile\fR\|(5), \&\flfirejail-login\fR\|(5) \&\flfirejail-config\fR\|(5)