<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Libre Things &#187; chroot</title>
	<atom:link href="http://positon.org/tag/chroot/feed" rel="self" type="application/rss+xml" />
	<link>http://positon.org</link>
	<description></description>
	<lastBuildDate>Tue, 23 Feb 2016 20:01:11 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.7.1</generator>
	<item>
		<title>SFTP chroot + rsync</title>
		<link>http://positon.org/sftp-chroot-rsync</link>
		<comments>http://positon.org/sftp-chroot-rsync#comments</comments>
		<pubDate>Fri, 09 Oct 2009 16:12:00 +0000</pubDate>
		<dc:creator><![CDATA[dooblem]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[chroot]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[SFTP]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://positon.org:81/?p=62</guid>
		<description><![CDATA[Here is howto make sftp shares with chroot. In /etc/ssh/sshd_config: # we use openssh internal sftp # because /usr/lib/openssh/sftp-server won't be available in chroot Subsystem sftp internal-sftp Match group sftp ChrootDirectory %h X11Forwarding no AllowTcpForwarding no ForceCommand internal-sftp UPDATE 17/06/2010: Beware with the syntax! Comments must start at the line beginning, and no spaces at [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Here is howto make sftp shares with chroot.</p>
<p>In <code>/etc/ssh/sshd_config</code>:</p>
<pre>
# we use openssh internal sftp
# because /usr/lib/openssh/sftp-server won't be available in chroot
Subsystem sftp internal-sftp

Match group sftp
        ChrootDirectory %h
        X11Forwarding no
        AllowTcpForwarding no
        ForceCommand internal-sftp
</pre>
<p><strong>UPDATE 17/06/2010:</strong> Beware with the syntax! Comments must start at the line beginning, and no spaces at the end of the <code>ForceCommand internal-sftp</code> line.</p>
<p>Now just create users belonging to sftp group, and that&#8217;s it.<br />
Test it with:</p>
<pre>
sftp user@myserver.com
</pre>
<p><strong>Problem: we cannot use the rsync command to send files</strong>, because rsync is not available in the chroot.</p>
<p>First, we allow other commands, commenting the line:</p>
<pre>
#ForceCommand internal-sftp
</pre>
<p>Then, we build the following tree in the chroot directory:</p>
<pre>
bin/
bin/bash
bin/rsync
lib/
lib/libncurses.so.5
lib/ld-linux.so.2
lib/libacl.so.1
lib/libpopt.so.0
lib/libattr.so.1
lib/i686
lib/i686/cmov
lib/i686/cmov/libdl.so.2
lib/i686/cmov/libc.so.6
</pre>
<p>We must put both <code>bash</code> and <code>rsync</code> commands, and all their librairies (you can display them with the <code>ldd</code> command).</p>
<p>Note: the user must have <code>/bin/bash</code> as default shell.</p>
<p>Note2: the chroot dir must belong to root, even if it&#8217;s the user&#8217;s folder. To allow the user to write in it, you have to create a subfolder with appropriate permissions. According to OpenSSH programers, it&#8217;s a big constraint, but very important for a chroot&#8217;s security.</p>
<p><ins>References</ins> :</p>
<ul>
<li><code>man sshd_config</code></li>
<li><a href="http://www.debian-administration.org/articles/590" title="http://www.debian-administration.org/articles/590">http://www.debian-administration.org/articles/590</a></li>
<li><a href="http://www.howtoforge.org/chrooted-ssh-sftp-tutorial-debian-lenny" title="http://www.howtoforge.org/chrooted-ssh-sftp-tutorial-debian-lenny">http://www.howtoforge.org/chrooted-ssh-sftp-tutorial-debian-lenny</a></li>
<li><a href="http://www.fuschlberger.net/programs/ssh-scp-sftp-chroot-jail/" title="http://www.fuschlberger.net/programs/ssh-scp-sftp-chroot-jail/">http://www.fuschlberger.net/programs/ssh-scp-sftp-chroot-jail/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://positon.org/sftp-chroot-rsync/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
