<s>
A	O
chroot	B-Application
on	O
Unix	B-Application
and	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
is	O
an	O
operation	O
that	O
changes	O
the	O
apparent	O
root	B-Application
directory	I-Application
for	O
the	O
current	O
running	O
process	O
and	O
its	O
children	B-Operating_System
.	O
</s>
<s>
The	O
term	O
"	O
chroot	B-Application
"	O
may	O
refer	O
to	O
the	O
system	B-Operating_System
call	I-Operating_System
or	O
the	O
wrapper	O
program	O
.	O
</s>
<s>
The	O
modified	O
environment	O
is	O
called	O
a	O
chroot	B-Application
jail	I-Application
.	O
</s>
<s>
The	O
chroot	B-Application
system	B-Operating_System
call	I-Operating_System
was	O
introduced	O
during	O
development	O
of	O
Version	B-Operating_System
7	I-Operating_System
Unix	I-Operating_System
in	O
1979	O
.	O
</s>
<s>
One	O
source	O
suggests	O
that	O
Bill	O
Joy	O
added	O
it	O
on	O
18	O
March	O
1982	O
–	O
17	O
months	O
before	O
4.2BSD	B-Operating_System
was	O
released	O
–	O
in	O
order	O
to	O
test	O
its	O
installation	O
and	O
build	O
system	O
.	O
</s>
<s>
All	O
versions	O
of	O
BSD	B-Operating_System
that	O
had	O
a	O
kernel	B-Operating_System
have	O
chroot(2 )	O
.	O
</s>
<s>
An	O
early	O
use	O
of	O
the	O
term	O
"	O
jail	B-Language
"	O
as	O
applied	O
to	O
chroot	B-Application
comes	O
from	O
Bill	O
Cheswick	O
creating	O
a	O
honeypot	O
to	O
monitor	O
a	O
hacker	O
in	O
1991	O
.	O
</s>
<s>
The	O
first	O
article	O
about	O
a	O
jailbreak	O
has	O
been	O
discussed	O
on	O
the	O
security	O
column	O
of	O
SunWorld	O
Online	O
which	O
is	O
written	O
by	O
Carole	O
Fennelly	O
;	O
the	O
August	O
1999	O
and	O
January	O
1999	O
editions	O
cover	O
most	O
of	O
the	O
chroot( )	O
topics	O
.	O
</s>
<s>
To	O
make	O
it	O
useful	O
for	O
virtualization	B-Application
,	O
FreeBSD	B-Operating_System
expanded	O
the	O
concept	O
and	O
in	O
its	O
4.0	O
release	O
in	O
2000	O
introduced	O
the	O
jail	B-Language
command	B-Application
.	O
</s>
<s>
By	O
2005	O
,	O
Sun	O
released	O
Solaris	O
Containers	B-Application
(	O
also	O
known	O
as	O
Solaris	O
Zones	O
)	O
,	O
described	O
as	O
"	O
chroot	B-Application
on	O
steroids.	O
"	O
</s>
<s>
By	O
2008	O
,	O
LXC	B-Application
(	O
upon	O
which	O
Docker	B-Language
was	O
later	O
built	O
)	O
adopted	O
the	O
"	O
container	B-Application
"	O
terminology	O
and	O
gained	O
popularity	O
in	O
2013	O
due	O
to	O
inclusion	O
into	O
Linux	B-Operating_System
kernel	I-Operating_System
3.8	O
of	O
user	B-Architecture
namespaces	I-Architecture
.	O
</s>
<s>
A	O
chroot	B-Application
environment	I-Application
can	O
be	O
used	O
to	O
create	O
and	O
host	O
a	O
separate	O
virtualized	B-Application
copy	O
of	O
the	O
software	O
system	O
.	O
</s>
<s>
Testing	O
and	O
development	O
A	O
test	O
environment	O
can	O
be	O
set	O
up	O
in	O
the	O
chroot	B-Application
for	O
software	O
that	O
would	O
otherwise	O
be	O
too	O
risky	O
to	O
deploy	O
on	O
a	O
production	O
system	O
.	O
</s>
<s>
Dependency	O
control	O
Software	O
can	O
be	O
developed	O
,	O
built	O
and	O
tested	O
in	O
a	O
chroot	B-Application
populated	O
only	O
with	O
its	O
expected	O
dependencies	O
.	O
</s>
<s>
Compatibility	O
Legacy	O
software	O
or	O
software	O
using	O
a	O
different	O
ABI	B-Operating_System
must	O
sometimes	O
be	O
run	O
in	O
a	O
chroot	B-Application
because	O
their	O
supporting	O
libraries	O
or	O
data	O
files	O
may	O
otherwise	O
clash	O
in	O
name	O
or	O
linkage	O
with	O
those	O
of	O
the	O
host	O
system	O
.	O
</s>
<s>
Recovery	O
Should	O
a	O
system	O
be	O
rendered	O
unbootable	O
,	O
a	O
chroot	B-Application
can	O
be	O
used	O
to	O
move	O
back	O
into	O
the	O
damaged	O
environment	O
after	O
bootstrapping	O
from	O
an	O
alternate	O
root	B-Application
file	I-Application
system	I-Application
(	O
such	O
as	O
from	O
installation	O
media	O
,	O
or	O
a	O
Live	O
CD	O
)	O
.	O
</s>
<s>
Privilege	O
separation	O
Programs	O
are	O
allowed	O
to	O
carry	O
open	O
file	B-Application
descriptors	I-Application
(	O
for	O
files	O
,	O
pipelines	B-Operating_System
and	O
network	O
connections	O
)	O
into	O
the	O
chroot	B-Application
,	O
which	O
can	O
simplify	O
jail	B-Language
design	O
by	O
making	O
it	O
unnecessary	O
to	O
leave	O
working	O
files	O
inside	O
the	O
chroot	B-Application
directory	O
.	O
</s>
<s>
Note	O
that	O
chroot	B-Application
is	O
not	O
necessarily	O
enough	O
to	O
contain	O
a	O
process	O
with	O
root	B-Application
privileges	I-Application
.	O
</s>
<s>
The	O
chroot	B-Application
mechanism	O
is	O
not	O
intended	O
to	O
defend	O
against	O
intentional	O
tampering	O
by	O
privileged	O
(	O
root	O
)	O
users	O
.	O
</s>
<s>
On	O
most	O
systems	O
,	O
chroot	B-Application
contexts	O
do	O
not	O
stack	O
properly	O
and	O
chrooted	B-Application
programs	O
with	O
sufficient	O
privileges	O
may	O
perform	O
a	O
to	O
break	O
out	O
.	O
</s>
<s>
To	O
mitigate	O
the	O
risk	O
of	O
these	O
security	O
weakness	O
,	O
chrooted	B-Application
programs	O
should	O
relinquish	O
root	B-Application
privileges	I-Application
as	O
soon	O
as	O
practical	O
after	O
chrooting	O
,	O
or	O
other	O
mechanisms	O
–	O
such	O
as	O
FreeBSD	B-Language
jails	I-Language
–	O
should	O
be	O
used	O
instead	O
.	O
</s>
<s>
Note	O
that	O
some	O
systems	O
,	O
such	O
as	O
FreeBSD	B-Operating_System
,	O
take	O
precautions	O
to	O
prevent	O
a	O
second	O
chroot	B-Application
attack	O
.	O
</s>
<s>
On	O
systems	O
that	O
support	O
device	B-Application
nodes	I-Application
on	O
ordinary	O
filesystems	O
,	O
a	O
chrooted	B-Application
root	B-Application
user	I-Application
can	O
still	O
create	O
device	B-Application
nodes	I-Application
and	O
mount	O
the	O
file	O
systems	O
on	O
them	O
;	O
thus	O
,	O
the	O
chroot	B-Application
mechanism	O
is	O
not	O
intended	O
by	O
itself	O
to	O
be	O
used	O
to	O
block	O
low-level	O
access	O
to	O
system	O
devices	O
by	O
privileged	O
users	O
.	O
</s>
<s>
It	O
is	O
not	O
intended	O
to	O
restrict	O
the	O
use	O
of	O
resources	O
like	O
I/O	B-General_Concept
,	O
bandwidth	O
,	O
disk	O
space	O
or	O
CPU	O
time	O
.	O
</s>
<s>
Most	O
Unixes	B-Application
are	O
not	O
completely	O
file	O
system-oriented	O
and	O
leave	O
potentially	O
disruptive	O
functionality	O
like	O
networking	O
and	O
process	O
control	O
available	O
through	O
the	O
system	B-Operating_System
call	I-Operating_System
interface	O
to	O
a	O
chrooted	B-Application
program	O
.	O
</s>
<s>
At	O
startup	O
,	O
programs	O
expect	O
to	O
find	O
scratch	B-General_Concept
space	I-General_Concept
,	O
configuration	O
files	O
,	O
device	B-Application
nodes	I-Application
and	O
shared	O
libraries	O
at	O
certain	O
preset	O
locations	O
.	O
</s>
<s>
For	O
a	O
chrooted	B-Application
program	O
to	O
successfully	O
start	O
,	O
the	O
chroot	B-Application
directory	O
must	O
be	O
populated	O
with	O
a	O
minimum	O
set	O
of	O
these	O
files	O
.	O
</s>
<s>
This	O
can	O
make	O
chroot	B-Application
difficult	O
to	O
use	O
as	O
a	O
general	O
sandboxing	O
mechanism	O
.	O
</s>
<s>
Only	O
the	O
root	B-Application
user	I-Application
can	O
perform	O
a	O
chroot	B-Application
.	O
</s>
<s>
This	O
is	O
intended	O
to	O
prevent	O
users	O
from	O
putting	O
a	O
setuid	O
program	O
inside	O
a	O
specially	O
crafted	O
chroot	B-Application
jail	I-Application
(	O
for	O
example	O
,	O
with	O
a	O
fake	O
and	O
file	O
)	O
that	O
would	O
fool	O
it	O
into	O
a	O
privilege	O
escalation	O
.	O
</s>
<s>
Some	O
Unixes	B-Application
offer	O
extensions	O
of	O
the	O
chroot	B-Application
mechanism	O
to	O
address	O
at	O
least	O
some	O
of	O
these	O
limitations	O
(	O
see	O
Implementations	O
of	O
operating	B-Application
system-level	I-Application
virtualization	I-Application
technology	O
)	O
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
run	O
graphical	O
applications	O
on	O
a	O
chrooted	B-Application
environment	I-Application
,	O
using	O
methods	O
such	O
as	O
:	O
</s>
<s>
An	O
X11	O
VNC	B-Protocol
server	I-Protocol
and	O
connecting	O
a	O
VNC	B-Protocol
client	O
outside	O
the	O
environment	O
.	O
</s>
<s>
The	O
Postfix	B-Application
mail	O
transfer	O
agent	O
operates	O
as	O
a	O
pipeline	B-Operating_System
of	O
individually	O
chrooted	B-Application
helper	O
programs	O
.	O
</s>
<s>
Like	O
4.2BSD	B-Operating_System
before	O
it	O
,	O
the	O
Debian	O
and	O
Ubuntu	O
internal	O
package-building	O
farms	O
use	O
chroots	B-Application
extensively	O
to	O
catch	O
unintentional	O
build	O
dependencies	O
between	O
packages	O
.	O
</s>
<s>
Fedora	O
,	O
Red	O
Hat	O
,	O
and	O
various	O
other	O
RPM-based	B-Application
distributions	O
build	O
all	O
RPMs	B-Application
using	O
a	O
chroot	B-Application
tool	O
such	O
as	O
.	O
</s>
<s>
Many	O
FTP	B-Protocol
servers	I-Protocol
for	O
POSIX	O
systems	O
use	O
the	O
chroot	B-Application
mechanism	O
to	O
sandbox	O
untrusted	O
FTP	B-Protocol
clients	I-Protocol
.	O
</s>
<s>
This	O
may	O
be	O
done	O
by	O
forking	O
a	O
process	O
to	O
handle	O
an	O
incoming	O
connection	O
,	O
then	O
chrooting	O
the	O
child	O
(	O
to	O
avoid	O
having	O
to	O
populate	O
the	O
chroot	B-Application
with	O
libraries	O
required	O
for	O
program	O
startup	O
)	O
.	O
</s>
<s>
If	O
privilege	O
separation	O
is	O
enabled	O
,	O
the	O
OpenSSH	B-Language
daemon	O
will	O
chroot	B-Application
an	O
unprivileged	O
helper	O
process	O
into	O
an	O
empty	O
directory	O
to	O
handle	O
pre-authentication	O
network	O
traffic	O
for	O
each	O
client	O
.	O
</s>
<s>
The	O
daemon	O
can	O
also	O
sandbox	O
SFTP	O
and	O
shell	O
sessions	O
in	O
a	O
chroot	B-Application
(	O
from	O
version	O
4.9p1	O
onwards	O
)	O
.	O
</s>
<s>
ChromeOS	B-Operating_System
can	O
use	O
a	O
chroot	B-Application
to	O
run	O
a	O
Linux	B-Operating_System
instance	O
using	O
Crouton	B-Application
,	O
providing	O
an	O
otherwise	O
thin	O
OS	O
with	O
access	O
to	O
hardware	O
resources	O
.	O
</s>
<s>
To	O
have	O
a	O
functional	O
chroot	B-Application
environment	I-Application
in	O
Linux	B-Operating_System
,	O
the	O
kernel	B-Operating_System
virtual	O
file	O
systems	O
and	O
configuration	O
files	O
also	O
have	O
to	O
be	O
mounted/copied	O
from	O
host	O
to	O
chroot	B-Application
.	O
</s>
