Jailkit Installation Guide For Linux v1.0
Jailkit Installation Guide For Linux v1.0
Jailkit Installation Guide For Linux v1.0
2011
Jailkit Installation on Linux
Document Version:
Page -2
Jailkit Installation Guide For Linux
Contents
1. Introduction .......................................................................................................................................... 4
2. Notations............................................................................................................................................... 4
3. Prerequisites ......................................................................................................................................... 4
4. Assumptions .......................................................................................................................................... 5
5. Install the jailkit ..................................................................................................................................... 5
5.1. Download the source .................................................................................................................... 5
5.2. Extract and compile it ................................................................................................................... 5
5.3. Installation the jailkit .................................................................................................................... 5
6. Jailkit configuration files ....................................................................................................................... 6
7. Creating the Jail..................................................................................................................................... 6
8. Creating a jailed user with interactive shell .......................................................................................... 7
8.1. Create System user ....................................................................................................................... 7
8.2. Migrate the user to jail ................................................................................................................. 7
9. Testing user login with putty ................................................................................................................ 7
10. Addition new commands for jailed users ......................................................................................... 8
Page -3
Jailkit Installation Guide For Linux
1. Introduction
This document is a step by step guideline prepared for marlon4 to install jailkit on a Linux
system. This guide should be used as-it-is. It doesn’t guarantee to be usable for any future
Linux because of the nature of the changes in the distribution. However it’s tested in almost
all current modern Linux irrespective of the distribution.
Normally it takes ten minutes or less to install the all the steps described in the document
by any normal caliber system admin. However, it’s recommended to follow the steps
carefully and confirm that the steps completed successfully without any error.
2. Notations
Below notations are used throughout the document to distinguish the texts and their
purposes.
3. Prerequisites
There are some prerequisites before proceeding to the installation. They are:
a. Source of jailkit should be downloaded first before starting to installation. You can
download jailkit from http://olivier.sessink.nl/jailkit/index.html#download
b. You have the root privileges of the system.
c. A C compiler (preferred gcc) and make are installed properly along with necessary
libraries.
Page -4
Jailkit Installation Guide For Linux
d. Other general Linux utilities like tar, gzip etc are installed and readily available in
the path.
4. Assumptions
Below assumptions are made while follow this guide and instructions:
a. The source of jailkit are kept in /soft folder. Means create a folder named soft in /
folder, download jailkit from http://olivier.sessink.nl/jailkit/index.html#download.
b. You can edit/create any file in the Linux system.
c. You have general understanding of Linux system administration including user
add/remove, how chroot environment works, file utilities etc. Though this is not a
prerequisites to understand and execute the steps described in this document, it will
help you to better understand the commands and effects.
d. The jail folder that we want to put all users is /jailroot. You can use any, of course.
e. The name of the user we want to put in jail is steve.
$ cd /soft
$ wget http://olivier.sessink.nl/jailkit/jailkit-2.13.tar.bz2
Page -5
Jailkit Installation Guide For Linux
# cd /soft/jailkit-2.13
# make install
[basicshell]
comment = bash based shell with several basic utilities
paths = /bin/sh, bash, ls, cat, chmod, mkdir, cp, cpio, date, dd, echo, egrep,
users = root
groups = root
[ssh]
comment = ssh secure shell
paths = ssh
includesections = netbasics, uidbasics
devices = /dev/urandom, /dev/tty, /dev/null Page -6sample.
Jk_init.ini file content
Jailkit Installation Guide For Linux
Let’s say we have decided to add basic shell commands (basicshell set), some editors
(editors set) and network utilities (netutils set) for our jail.
Issue below command as root to create the jail. Remember that we have decided in our
assumptions that our jail is /jailroot.
# jk_init -v -j /jailroot basicshell editors netutils
Depending on your Linux distribution and useradd command version, you may need to add –m option
after –d </home/username> to create the home directory.
The command will also move the home folder from system to the jail folder. You will see some changes
in /etc/passwd and /jailroot/etc/passwd files.
…
sifat:x:1000:100::/home/sifat:/bin/bash /etc/passwd file content sample.
joomla:x:1001:100::/var/www/htdocs/Joomla:/bin/bash
steve:x:1009:100::/jailroot/./home/steve:/usr/sbin/jk_chrootsh
….
You can see the home folder of steve is now changed /jailroot/./home/steve which means jk_chrootsh
program will consider that /jailroot will be the chroot for steve and his home will be /home/steve in the
/jailroot folder.
Page -7
Jailkit Installation Guide For Linux
Page -8