CHROOT
Updated April 28, 2004
Created April 11, 2002


Autogenerated Site Map
Search this Site!:
Search this site powered by FreeFind

prev next index
In theory using a chroot environment should work as follows:

This example makes a chroot environment with bash, ls, tar, and gzip, suitable for extracting a backup that was created using absolute pathnames :(
mkdir /tmp/tar-chroot
mkdir /tmp/tar-chroot/bin
mkdir /tmp/tar-chroot/dev
mkdir /tmp/tar-chroot/lib
cp -a /bin/bash /tmp/tar-chroot/bin
cp -a /bin/gzip /tmp/tar-chroot/bin
cp -a /bin/ls   /tmp/tar-chroot/bin
cp -a /bin/tar  /tmp/tar-chroot/bin
mknod /tmp/tar-chroot/dev/st0 c 9 0
cp -a /lib/ld-linux.so.2       /tmp/tar-chroot/lib
cp -a /lib/ld-2.2.4.so         /tmp/tar-chroot/lib
cp -a /lib/libc.so.6           /tmp/tar-chroot/lib
cp -a /lib/libc-2.2.4.so       /tmp/tar-chroot/lib
cp -a /lib/libdl.so.2          /tmp/tar-chroot/lib
cp -a /lib/libdl-2.2.4.so      /tmp/tar-chroot/lib
cp -a /lib/libtermcap.so.2     /tmp/tar-chroot/lib
cp -a /lib/libtermcap.so.2.0.8 /tmp/tar-chroot/lib
chroot /tmp/tar-chroot
tar -xzvf /dev/st0
Please note that even though you may not have put all kinds of commands in this chroot environment, you still can start up another shell (outside the chroot environment) and enter this direcotry to manipulate the environment, such as making new directories, etc.

Please also note that this environment is very similar to what you find in /var/ftp. The anonymous ftp server uses this environment to lock the anonymous user into this chroot jail so they can't get out and do damage anywhere else on your system.:
/var/ftp
/var/ftp/bin
/var/ftp/bin/ls
/var/ftp/bin/bin.md5
/var/ftp/bin/cpio
/var/ftp/bin/tar
/var/ftp/bin/gzip
/var/ftp/bin/zcat
/var/ftp/bin/compress
/var/ftp/etc
/var/ftp/etc/ld.so.conf
/var/ftp/etc/group
/var/ftp/etc/passwd
/var/ftp/etc/ld.so.cache
/var/ftp/lib
/var/ftp/lib/ld-2.2.4.so
/var/ftp/lib/libc-2.2.4.so
/var/ftp/lib/libnsl-2.2.4.so
/var/ftp/lib/libnss_files-2.2.4.so
/var/ftp/lib/libs.md5
/var/ftp/lib/libnss_files.so.2
/var/ftp/lib/libnsl.so.1
/var/ftp/lib/libc.so.6
/var/ftp/lib/ld-linux.so.2
/var/ftp/lib/libtermcap.so.2.0.8
/var/ftp/lib/libtermcap.so.2
/var/ftp/pub

prev next index
Search this Site!:
Search this site powered by FreeFind

Homepage: http://www.cpqlinux.com
Site Map: http://www.cpqlinux.com/sitemap.html