blob: 1d85385e7846353b394c43cfa1e5cf4da58796c2 [file] [log] [blame]
Elly Jonese58176c2012-01-23 11:46:17 -05001.TH MINIJAIL0 "1" "January 2012" "Chromium OS" "User Commands"
Elly Jonescd7a9042011-07-22 13:56:51 -04002.SH NAME
3minijail0 \- sandbox a process
4.SH SYNOPSIS
5.B minijail0
6[\fIOPTION\fR]... <\fIprogram\fR> [\fIargs\fR]...
7.SH DESCRIPTION
8.PP
9Runs PROGRAM inside a sandbox.
10.TP
Elly Jones51a5b6c2011-10-12 19:09:26 -040011\fB-b <src>,<dest>[,<writeable>]
12Bind-mount <src> into the chroot directory at <dest>, optionally writeable.
13.TP
Elly Jonescd7a9042011-07-22 13:56:51 -040014\fB-c <caps>\fR
15Restrict capabilities to \fIcaps\fR. When used in conjunction with \fB-u\fR and
Elly Jones51a5b6c2011-10-12 19:09:26 -040016.TP
17\fB-C <dir>\fR
18Change root (using chroot(2)) to <dir>.
19.TP
Lee Campbell11af0622014-05-22 12:36:04 -070020\fB-t\fR
21Mounts a tmpfs filesystem on /tmp. /tmp must exist in the chroot.
22This must be used with -C. The default filesystem has a max size of 128M
23and has standard /tmp permissions (777).
24.TP
Elly Jonescd7a9042011-07-22 13:56:51 -040025\fB-g\fR, this allows a program to have access to only certain parts of root's
26default privileges while running as another user and group ID altogether. Note
27that these capabilities are not inherited by subprocesses of the process given
28capabilities unless those subprocesses have POSIX file capabilities. See
29\fBcapabilities\fR(7).
30.TP
31\fB-G\fR
32Inherit all the supplementary groups of the user specified with \fB-u\fR. It
33is an error to use this option without having specified a \fBuser name\fR to
34\fB-u\fR.
35.TP
36\fB-g <group>\fR
37Change groups to \fIgroup\fR, which may be either a group name or a numeric
38group ID.
39.TP
40\fB-h\fR
41Print a help message.
42.TP
Will Drewry32ac9f52011-08-18 21:36:27 -050043\fB-H\fR
44Print a help message detailing supported system call names for seccomp_filter.
45(Other direct numbers may be specified if minijail0 is not in sync with the
46 host kernel or something like 32/64-bit compatibility issues exist.)
47.TP
Elly Jonescd7a9042011-07-22 13:56:51 -040048\fB-p\fR
49Run inside a new PID namespace. This option will make it impossible for the
Elly Jonese58176c2012-01-23 11:46:17 -050050program to see or affect processes that are not its descendants. This implies
51\fB-v\fR and \fB-r\fR, since otherwise the process can see outside its namespace
52by inspecting /proc.
Elly Jonescd7a9042011-07-22 13:56:51 -040053.TP
54\fB-r\fR
55Remount certain filesystems readonly. Currently this only remounts /proc. This
56implies \fB-v\fR. Remounting /proc readonly means that even if the process has
57write access to a system config knob in /proc (e.g., in /sys/kernel), it cannot
58change the value.
59.TP
60\fB-s\fR
61Enable seccomp(2) in mode 1, which restricts the child process to a very small
Will Drewry32ac9f52011-08-18 21:36:27 -050062set of system calls.
63.TP
64\fB-S <arch-specific seccomp_filter policy file>\fR
65Enable seccomp(2) in mode 13 which restricts the child process to a set of
66system calls defined in the policy file. Note that system calls often change
67names based on the architecture or mode. (uname -m is your friend.)
Elly Jonescd7a9042011-07-22 13:56:51 -040068.TP
69\fB-u <user>\fR
70Change users to \fIuser\fR, which may be either a user name or a numeric user
71ID.
72.TP
73\fB-v\fR
74Run inside a new VFS namespace. This option makes the program's mountpoints
75independent of the rest of the system's.
76.SH IMPLEMENTATION
77This program is broken up into two parts: \fBminijail0\fR (the frontend) and a helper
78library called \fBlibminijailpreload\fR. Some jailings can only be achieved from
79the process to which they will actually apply - specifically capability use
80(since capabilities are not inherited to an exec'd process unless the exec'd
81process has POSIX file capabilities), seccomp (since we can't exec() once we're
82seccomp'd), and ptrace-disable (which is always cleared on exec().
83
84To this end, \fBlibminijailpreload\fR is forcibly loaded into all
85dynamically-linked target programs if any of these restrictions are in effect;
86we pass the specific restrictions in an environment variable which the preloaded
87library looks for. The forcibly-loaded library then applies the restrictions
88to the newly-loaded program.
89.SH AUTHOR
90Written by Elly Jones (ellyjones@chromium.org)
91.SH COPYRIGHT
92Copyright \(co 2011 The Chromium OS Authors
93License BSD-like.
94.SH "SEE ALSO"
Will Drewry32ac9f52011-08-18 21:36:27 -050095\fBlibminijail.h\fR \fBminijail0(5)\fR