Skip to content

Instantly share code, notes, and snippets.

@RobinDavid
Created February 25, 2014 17:51
Show Gist options
  • Save RobinDavid/9214151 to your computer and use it in GitHub Desktop.
Save RobinDavid/9214151 to your computer and use it in GitHub Desktop.
script to create an nice chroot to a given folder
#!/bin/bash
ROOT=$1
mount procfs -t proc $ROOT/proc/
mount sysfs -t sysfs
mount -o bin /dev $ROOT/dev/
mount -o bin /dev/pts $ROOT/dev/pts
mount --bind /etc/resolv.conf $ROOT/etc/resolv.conf
chroot $ROOT
umount $ROOT/etc/resolv.conf
umount $ROOT/proc/
umount $ROOT/sys/
umount $ROOT/dev/pts/
umount $ROOT/dev/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment