Skip to content

Instantly share code, notes, and snippets.

@pottedplant
Last active September 7, 2017 10:54
Show Gist options
  • Save pottedplant/5ef1833c78bea3b10e05b25a244f9a68 to your computer and use it in GitHub Desktop.
Save pottedplant/5ef1833c78bea3b10e05b25a244f9a68 to your computer and use it in GitHub Desktop.
#!/bin/bash -xe
root=$1
unshare --ipc --mount --pid --uts --cgroup --fork -- bash -e -c \
"
mount --rbind /sys \"${root}/sys\"
mount --rbind /dev \"${root}/dev\"
mount -t proc none \"${root}/proc\"
mount -t tmpfs none \"${root}/run\"
mkdir \"${root}/run/lock\"
chroot \"${root}\" bash -l
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment