aboutsummaryrefslogtreecommitdiffstats
path: root/src/man/firejail.txt
blob: cfd00456b4d4102afca39b2318181e36ffc18b24 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
.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
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-syscalls | \-\-help |
.br
\-\-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 chroot 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 directories mounted read-only.
Only /home, /tmp and /var directories 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 SECURITY PROFILES section.
.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
Multiple commands can be run in sandbox using regular bash logic operators:
.PP
# sudo firejail [OPTIONS] "/etc/init.d/nginx start && sleep inf"
.PP
In the previous example, "sleep inf" command is required in order to keep the session open for the daemon program.

.SH OPTIONS
.TP
\fB\-\-
Signal the end of options and disables further option processing.
.TP
\fB\-\-bandwidth=name
Set bandwidth limits for the sandbox identified by name, see TRAFFIC SHAPING section for more details.
.TP
\fB\-\-bandwidth=pid
Set bandwidth limits for the sandbox identified by PID, see TRAFFIC SHAPING section for more details.
.TP
\fB\-\-bind=dirname1,dirname2
Mount-bind dirname1 on top of dirname2. This option is only available when running the sandbox as root.
.br

.br
Example:
.br
# firejail \-\-bind=/config/www,/var/www
.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=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 && sleep inf"

.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 && sleep inf"

.TP
\fB\-\-caps.print=name
Print the caps filter for the sandbox identified by name.
.br

.br
Example:
.br
$ firejail \-\-name=mygame \-\-caps.drop=all warzone2100 &
.br
[...]
.br
$ firejail \-\-caps.print=mygame

.TP
\fB\-\-caps.print=pid
Print the caps filter for a sandbox identified by PID.
.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. If the sandbox is started as a
regular user, default seccomp and capabilities filters are enabled.
.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\-\-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-syscalls
Print all recognized system calls in the current Firejail software build and exit.
.br

.br
Example:
.br
$ firejail \-\-debug-syscalls
.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\-\-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
Print DNS configuration for a sandbox identified by name.
.br

.br
Example:
.br
$ firejail \-\-name=mygame \-\-caps.drop=all warzone2100 &
.br
[...]
.br
$ firejail \-\-dns.print=mygame

.TP
\fB\-\-dns.print=pid
Print DNS configuration for a sandbox identified by PID.
.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\-?\fR, \fB\-\-help\fR
Print options end exit.
.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\-\-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
Join 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.
.br

.br
Example:
.br
$ firejail \-\-name=mygame \-\-caps.drop=all warzone2100 &
.br
[...]
.br
$ firejail \-\-join=mygame


.TP
\fB\-\-join=pid
Join the sandbox identified 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.
.br

.br
Example:
.br
$ firejail \-\-list
.br
3272:netblue:firejail \-\-private firefox
.br
$ firejail \-\-join=3272

.TP
\fB\-\-list
List all sandboxes, see MONITORING 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\-\-name=name
Set sandbox hostname. 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.
.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
\-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
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
Example:
.br
$ firejail \-\-net=eth0 \-\-netfilter=myfile firefox
.TP
\fB\-\-netstats
Monitor network namespace statistics, see MONITORING section for more details.
.br

.br
Example:
.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\-\-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\-\-output=logfile
stdout logging and log rotation. Copy stdout 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. All filesystem modifications go into the overlay.
The overlay is stored in $HOME/.firejail directory.
.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.
.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-keep=file,directory
This option is deprecated, use private-home instead

.TP
\fB\-\-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.
.br

.br
Example:
.br
$ firejail \-\-private-home=.mozilla firefox
.TP
\fB\-\-private-dev
Create a new /dev directory. Only null, full, zero, tty, pts, ptmx, random, urandom 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
full  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\-\-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 SECURITY PROFILES section below.
.br

.br
Example:
.br
$ firejail \-\-profile=myprofile
.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\-\-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, open_by_handle_at, init_module, finit_module, delete_module,
iopl, ioperm, swapon, swapoff, syslog, process_vm_readv and process_vm_writev,
sysfs,_sysctl, adjtimex, clock_adjtime, lookup_dcookie, perf_event_open, fanotify_init and kcmp.
.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.print=name
Print the seccomp filter for the sandbox started using \-\-name option.
.br

.br
Example:
.br
$ firejail \-\-name=browser firefox &
.br
$ firejail \-\-seccomp.print=browser
.br
SECCOMP Filter:
.br
  VALIDATE_ARCHITECTURE
.br
  EXAMINE_SYSCAL
.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\-\-seccomp.print=pid
Print the seccomp filter for the sandbox specified by process ID. Use \-\-list option to get a list of all active sandboxes.
.br

.br
Example:
.br
$ firejail \-\-list
.br
10786:netblue:firejail \-\-name=browser firefox 
$ firejail \-\-seccomp.print=10786
.br
SECCOMP Filter:
.br
  VALIDATE_ARCHITECTURE
.br
  EXAMINE_SYSCAL
.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
Shutdown the sandbox started using \-\-name option.
.br

.br
Example:
.br
$ firejail \-\-name=mygame \-\-caps.drop=all warzone2100 &
.br
[...]
.br
$ firejail \-\-shutdown=mygame
.TP
\fB\-\-shutdown=pid
Shutdown the sandbox specified by process ID. Use \-\-list option to get a list of all active sandboxes.
.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.
.br

.br
Example:
.br
$ firejail \-\-tmpfs=/var
.TP
\fB\-\-top
Monitor the most CPU-intensive sandboxes, see MONITORING 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\-\-tree
Print a tree of all sandboxed processes, see MONITORING 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\-\-version
Print program version and exit.
.br

.br
Example:
.br
$ firejail \-\-version
.br
firejail version 0.9.27
.TP
\fB\-\-zsh
Use /usr/bin/zsh as default user shell.
.br

.br
Example:
.br
$ firejail \-\-zsh
.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 a default.profile file if the sandbox
is started by a regular user, or a 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 --noroot 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/password 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
Start a regular /bin/bash session in sandbox.
.TP
\f\firejail firefox
Start Mozilla Firefox.
.TP
\f\firejail \-\-seccomp firefox
Start Mozilla Firefox in a seccomp sandbox.
.TP
\f\firejail \-\-caps firefox
Start Mozilla Firefox in a Linux capabilities sandbox.
.TP
\f\firejail \-\-debug firefox
Debug Firefox sandbox.
.TP
\f\firejail \-\-private
Start a /bin/bash session with a new tmpfs home directory.
.TP
\f\firejail \-\-net=br0 ip=10.10.20.10
Start a /bin/bash session in a new network namespace. The session is
connected to the main network using br0 bridge device. An IP address
of 10.10.20.10 is assigned to the sandbox.
.TP
\f\firejail \-\-net=br0 \-\-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.
.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.sourceforge.net
.SH SEE ALSO
\&\flfiremon\fR\|(1),
\&\flfirejail-profile\fR\|(5),
\&\flfirejail-login\fR\|(5)