<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.d3xt3r01.tk//index.php?action=history&amp;feed=atom&amp;title=SSH_jail</id>
	<title>SSH jail - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.d3xt3r01.tk//index.php?action=history&amp;feed=atom&amp;title=SSH_jail"/>
	<link rel="alternate" type="text/html" href="https://wiki.d3xt3r01.tk//index.php?title=SSH_jail&amp;action=history"/>
	<updated>2026-05-05T17:28:47Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.d3xt3r01.tk//index.php?title=SSH_jail&amp;diff=6537&amp;oldid=prev</id>
		<title>Admin at 19:12, 25 January 2012</title>
		<link rel="alternate" type="text/html" href="https://wiki.d3xt3r01.tk//index.php?title=SSH_jail&amp;diff=6537&amp;oldid=prev"/>
		<updated>2012-01-25T19:12:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:12, 25 January 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.d3xt3r01.tk//index.php?title=SSH_jail&amp;diff=8&amp;oldid=prev</id>
		<title>Admin: New page: ==WHY== Because I wanted to jail some users .. for the fun of it .. they don&#039;t need to be able to move everywhere they want but basicaly .. I wanted to give some access to run a screen pro...</title>
		<link rel="alternate" type="text/html" href="https://wiki.d3xt3r01.tk//index.php?title=SSH_jail&amp;diff=8&amp;oldid=prev"/>
		<updated>2009-06-25T18:29:10Z</updated>

		<summary type="html">&lt;p&gt;New page: ==WHY== Because I wanted to jail some users .. for the fun of it .. they don&amp;#039;t need to be able to move everywhere they want but basicaly .. I wanted to give some access to run a screen pro...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==WHY==&lt;br /&gt;
Because I wanted to jail some users .. for the fun of it .. they don&amp;#039;t need to be able to move everywhere they want but basicaly .. I wanted to give some access to run a screen proccess in a chrooted environment .. so .. here it goes&lt;br /&gt;
&lt;br /&gt;
==HOW==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Step 1&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;: Getting, compiling, installing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wget http://wiki.d3xt3r01.tk/images/2/27/Jailkit-2.5.tar.gz&lt;br /&gt;
tar -xzf jailkit-2.5.tar.gz&lt;br /&gt;
cd jailkit-2.5&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install # be sure to do this part as root..&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Step 2&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;: Configuring&lt;br /&gt;
&lt;br /&gt;
Be sure to edit /etc/jailkit/jk_init.ini , some libs might be in different directories for other distros than Fedora ( which is what I&amp;#039;m using on the devel box ). I&amp;#039;ll want to put user &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;bling&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; in a jail in /mnt/dex/jail/bling .. If you run into a thingy saying it can&amp;#039;t find /etc/ld.so.conf .. see /etc/jailkit/jk_init.ini and add a &amp;#039;,&amp;#039; before it .. &lt;br /&gt;
&lt;br /&gt;
You&amp;#039;ll see that bash wants /usr/bin/id so add it to /etc/jailkit/jk_init.ini in the [basicshell] section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /mnt/dex # Be sure to chown root:root /mnt/dex too ! .. jk_init will tell you it&amp;#039;s not safe anyway .. &lt;br /&gt;
mkdir -p jail/bling&lt;br /&gt;
jk_init -v -j /mnt/dex/jail/bling basicshell # initialize his dir with the needed utilities&lt;br /&gt;
adduser bling # add the regular user&lt;br /&gt;
passwd bling # set the password for him ..&lt;br /&gt;
...&lt;br /&gt;
jk_jailuser -m -s /bin/bash -j /mnt/dex/jail/bling bling # modify his regular home to the new chroot&lt;br /&gt;
mkdir jail/bling/tmp&lt;br /&gt;
chmod a+rwx jail/bling/tmp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Adding another user==&lt;br /&gt;
Adding more users is as easy as redoing the step 2.&lt;br /&gt;
&lt;br /&gt;
==Adding other binaries==&lt;br /&gt;
Check out jk_init -l if you want your chrooted user to be able to access other stuff .. &lt;br /&gt;
&lt;br /&gt;
Also .. if you find something that&amp;#039;s not there .. simply do a &amp;#039;whereis binary&amp;#039; ; &amp;#039;jk_cp -v -j /path/to/jailroot /path/to/binary&amp;#039; and it&amp;#039;ll copy all the needed libraries with the right permissions and stuff .. Unfortunately jk_cp won&amp;#039;t manage to do everything .. at least not all the time .. so .. installing strace for the user and strace-ing what you want to use in his home would be a good idea .. it should show you what it tries to open so you can copy it to him from the real world :)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
jk_cp -v -j /mnt/dex/jail/bling /usr/bin/screen # to enable screen use .. don&amp;#039;t forget to mount dev and devpts&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other issues==&lt;br /&gt;
If you want that user to be able to use the internet .. you&amp;#039;d better copy your /etc/resolv.conf to the jailed root/etc dir .. or add netbasics to the jk_init line..&lt;br /&gt;
&lt;br /&gt;
Also .. if some programs complain about not knowing the terminal .. in fedora you should just copy usr/share/terminfo/ to the jail ( or add midnightcommander and xterm to the jk_init line ). Also edit /etc/jailkit/jk_chrootsh.ini and add this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[bling] # replace with the username ..&lt;br /&gt;
env= DISPLAY, XAUTHORITY, TERM, PATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PTYs==&lt;br /&gt;
Screen might complain about not having PTYs .. so after some research .. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /mnt/dex/jail/bling/dev&lt;br /&gt;
mount --bind /dev /mnt/dex/jail/bling/dev&lt;br /&gt;
mount --bind /dev/pts /mnt/dex/jail/bling/dev/pts&lt;br /&gt;
# mounting proc would be nice but do it only if you need it!&lt;br /&gt;
mount --bind /proc /mnt/dex/jail/bling/proc&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other info==&lt;br /&gt;
Some programs need /var/run .. so &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir -p /mnt/dex/jail/bling/var/run/screen&lt;br /&gt;
chmod 777 /mnt/dex/jail/bling/var/run/screen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
finch ( the pidgin cli client .. ) wants /var/lib/dbus/machine-id so ..&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir -p /mnt/dex/jail/bling/var/lib/dbus&lt;br /&gt;
cp /var/lib/dbus/machine-id /mnt/dex/jail/bling/var/lib/dbus&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HELP==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
jk_init --help&lt;br /&gt;
jk_jailuser --help&lt;br /&gt;
jk_cp --help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LINKS==&lt;br /&gt;
[http://olivier.sessink.nl/jailkit/howtos_ssh_only.html JAILKIT]&lt;br /&gt;
&lt;br /&gt;
[http://www.fuschlberger.net/programs/ssh-scp-sftp-chroot-jail/ fuschlberger.net]&lt;br /&gt;
&lt;br /&gt;
[http://www.linux.com/feature/61387 linux.com]&lt;br /&gt;
&lt;br /&gt;
[[Category:SSH]]&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:Jail]]&lt;br /&gt;
[[Category:HowTo]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>