Minimal chroot Environment

Tags: January 7, 2013 11:21 PM

I need to isolate the Mozilla Spidermonkey javascript shell. The goal is simple: Create a minimal chroot environment. So, here is my setup.

# mkdir /media/jail
# mkdir -p /media/jail/{bin,usr,lib,usr/lib,dev,sys,tmp,proc}
# chmod a+rwx /media/jail/tmp
# cp /bin/bash /media/jail/bash
Mount some special file systems and device files.
# mount -t proc proc /media/jail/proc
# mount -t sysfs -o rw,noexec,nosuid,nodev none /media/jail/sys
# mount -o bind /dev /media/jail/dev
# chroot /media/jail /bin/bash
Note: Use "mount" command to see what your system use for the proc, dev, sys, etc.


Share on Facebook Twitter


Post a Comment