How to chroot ssh user using Jailkit

Jailkit is a set of utilities to limit user accounts to specific files using chroot() and or specific commands. Jailkit is known to be used in network security appliances from several leading IT security firms, internet servers from several large enterprise organizations, internet servers from internet service providers, as well as many smaller companies and private users that need to secure cvs, sftp, shell or daemon processes. Jailkit is very useful for jailing applications and users that should (or need) to be isolated from the rest of the system (and from each other). The jail folder has a replication of the directory structure of a normal Linux box. The difference is that you only copy in the bare minimum of what you need into the directory structure. jailkit-ssh  

1. Install the jailkit

Download, compile & install the jailkit :

$ sudo apt-get install checkinstall && wget $ tar -zxvf jailkit-2.17.tar.gz $ cd jailkit-2.17 $ ./configure $ make $ sudo checkinstall && dpkg -i jailkit_2.17-1_amd64.deb

2. Setting up the jail chroot

sudo mkdir /var/www/ && sudo chown root. /var/www/
Create the environment (i give my user git power – if you don’t want to, just remove the git):
$ jk_init -v /var/www/ basicshell editors extendedshellnetutils ssh sftp jk_lsh git
Create & jail the user :
$ sudo adduser user-1 $ sudo jk_jailuser -m -j /var/www/
Make sure the /etc/passwd for user-1 is :

Create home folder & add your ssh public key 
$ sudo mkdir -p /var/www/<br />$ chown -R user-1./var/www/<br />$ vim/var/www/
The common problem with jailkit when user is cannot login can be see in this post.