These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX01/Creating A Chroot Structure

Classnotes | UNIX01 | RecentChanges | Preferences

Chroot is a slightly advanced UNIX concept. The basic premise behind it is that you can create a smaller duplicate of your working system inside of a subdirectory with restricted access inside your system. You can then chroot something (it could be a process, a user, or even yourself) into that directory, meaning you "change root" from normal root (/) to this new root. The purposes for this vary- you could be doing it for security reasons, as a way of doing system tests, or even performing a recovery on another system.

While we will not be using chroot in this class (that will wait for UNIX02 and UNIX03), we will start off by creating a simple chroot structure. This structure would be ready for chroot'ing in the future, though we will not be doing that in this class.

Create a directory called /home/jail/bob. Under that directory, recreate the essential directories of the root file system, namely:

 /etc
 /bin
 /lib
 /var
 /tmp
 /usr
 /home

Populate that directory structure with the following essential commands:

 /bin/ls
 /bin/cp
 /bin/rm
 /bin/mkdir
 /bin/grep
 /bin/pwd

as well as with the libraries located in /lib (note, you only want the libraries, not the kernel modules or any subdirectory of /lib).

You will also want the files:

 /etc/hosts
 /usr/bin/zip
 /usr/bin/ftp
 /usr/bin/at
 /usr/bin/cal


Classnotes | UNIX01 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited July 12, 2003 7:33 am (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.