Install Jailkit on Ubuntu/Debian
Jailkit is a set of utilities that can be used to setup a chroot based restricted environment where users have limited access to the file system and the commands they run. The jailkit utilities make it easy to setup a restricted shell or run services or programs inside such a restricted environment.
In this post we shall be installing the jailkit utilities on debian/ubuntu
Install jailkit on Ubuntu/Debian
1. Since jailkit would be compiled on the system, first of all, its necessary to get the build utilities to compile.
So install the following packages
$ sudo apt-get install build-essential autoconf automake libtool flex bison debhelper binutils-gold
2. Download Jailkit from the following url, or visit the website to get the latest url if it has changed.http://olivier.sessink.nl/jailkit/jailkit-2.16.tar.gz
$ wget http://olivier.sessink.nl/jailkit/jailkit-2.16.tar.gz
3. Extract the archive
$ tar -vxzf jailkit-2.16.tar.gz
4. Compile jailkit and create deb file
Jailkit already comes with necessary code and configurations to compile itself into a deb file that can be installed neatly on Debian based systems. Just run the following command and it should be done.
$ cd jailkit-2.16/ $ sudo ./debian/rules binary
5. Install the deb file
The previous command would create a deb file called jailkit_2.16-1_amd64.deb.
$ cd .. $ sudo dpkg -i jailkit_2.16-1_amd64.deb
Thats it. Now jailkit is installed. Jailkit makes many commands available which can be used to setup chroot based jailed environments. Here are the commands
$ jk_ jk_addjailuser jk_chrootlaunch jk_cp jk_jailuser jk_lsh jk_uchroot jk_check jk_chrootsh jk_init jk_list jk_socketd jk_update
All the above commands have man pages which contain more information about how to use them. Or read more about them at the website