Jailkit
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.
Project website
http://olivier.sessink.nl/jailkit/
In this post we shall be installing the jailkit utilities on debian/ubuntu
Install jailkit on Ubuntu/Debian
Jailkit can be installed from the repositories on Ubuntu.
$ sudo apt-get install jailkit
If it is not available in the repositories then you can download the source and compile directly. It will involve only a few steps.
1. Install Build Tools - 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
http://olivier.sessink.nl/jailkit/jailkit.8.htmlConclusion
The above simple steps showed how to install jailkit utilities. In the next article we shall see how to setup a jailed shell with jailkit. If you have any questions, let us know in the comments below.
sudo ./debian/rules binary
dh_testdir
dh_testroot
dh_clean -k -s
dh_clean: Compatibility levels before 5 are no longer supported (level 4 requested)
dh_clean: Compatibility levels before 5 are no longer supported (level 4 requested)
debian/rules:74: recipe for target ‘install-arch’ failed
make: *** [install-arch] Error 25
Why Debian dosn’t include deb package in their repository that I could install it through APT ?
As of today python is also a prerequisite on wheezy
configure: error: python not found please install python
make: *** [config.status] Error
I installed it by
apt-get install python
added the instructions to install the necessary tools for compiling jailkit
think this assumes that the relevant packaging tools are already installed?
The prerequisites are in one of the comments here: http://askubuntu.com/a/146388/67321