Following link gives a solution about Simple & easy way to jail users. Multiple comments mention that it does not work on Ubuntu 13.10, but there is no verification about that.
I have tried that solution on
Ubuntu 17.10 LTS. I was not able to make it work.
Setup: (Please note that I have get the code from with small changes.)
cd /tmp wget http://olivier.sessink.nl/jailkit/jailkit-2.17.tar.gz tar -zxvf jailkit-2.17.tar.gz cd jailkit-2.17 ./configure make make install jailDir='/var/lib/jail' sudo mkdir $jailDir sudo chown root:root $jailDir sudo jk_init -v $jailDir basicshell sudo jk_init -v $jailDir netutils sudo jk_init -v $jailDir ssh sudo jk_init -v $jailDir jk_lsh sudo useradd -d /var/lib/testuser -m testuser -s /bin/bash sudo jk_jailuser -m -j $jailDir testuser sudo jk_cp -v -f $jailDir /bin/bash
Later when I try to jail the user, I have faced following issues:
=> When I did
sudo su - testuser, I can see other jailed users' files, but I do not have access to
/home. It seems promising but now I cannot see any of the installed binaries and use them.
sudo -su testuser opens at the current directory I am, and it can still see other users' directory and files under
Please note that I am not doing ssh into the user, I am just switching the users after I have logged in.
[Q] Is it possible to do jail users under Ubuntu 17.10? It it correct way to do this?