<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: openssh 5.1 chrootdirectory permissions issue</title>
	<atom:link href="http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/</link>
	<description>Pondering the mystery...</description>
	<lastBuildDate>Sat, 06 Mar 2010 14:00:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: roborative</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-667</link>
		<dc:creator>roborative</dc:creator>
		<pubDate>Thu, 07 Jan 2010 02:30:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-667</guid>
		<description>My last message didn&#039;t turn out quite right (dang angle brackets!). Please substitute /home/username where you see /home/.</description>
		<content:encoded><![CDATA[<p>My last message didn&#8217;t turn out quite right (dang angle brackets!). Please substitute /home/username where you see /home/.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: roborative</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-666</link>
		<dc:creator>roborative</dc:creator>
		<pubDate>Thu, 07 Jan 2010 02:28:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-666</guid>
		<description>I found this page helpful but here are a couple of things that I came across elsewhere that might prove useful.

You can set the ChrootDirectory to a static value (such as /var/chroot -- that is, no %h or %u values) and then set the user&#039;s home directory to the standard home path (ie, /home/), create a home directory under the ChrootDirectory (eg, /var/chroot/home/), chown the directory to that user (ie, it doesn&#039;t have to belong to root), and the user will be placed in that directory.

Also, if you use this approach and want to support key-based auth then create a symbolic link in /home to the user&#039;s chroot directory (eg, /home/ -&gt; /var/chroot/home/) so that the key will be found on login.</description>
		<content:encoded><![CDATA[<p>I found this page helpful but here are a couple of things that I came across elsewhere that might prove useful.</p>
<p>You can set the ChrootDirectory to a static value (such as /var/chroot &#8212; that is, no %h or %u values) and then set the user&#8217;s home directory to the standard home path (ie, /home/), create a home directory under the ChrootDirectory (eg, /var/chroot/home/), chown the directory to that user (ie, it doesn&#8217;t have to belong to root), and the user will be placed in that directory.</p>
<p>Also, if you use this approach and want to support key-based auth then create a symbolic link in /home to the user&#8217;s chroot directory (eg, /home/ -&gt; /var/chroot/home/) so that the key will be found on login.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bockerl</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-602</link>
		<dc:creator>Bockerl</dc:creator>
		<pubDate>Thu, 17 Dec 2009 18:27:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-602</guid>
		<description>Thank you ... this has me very helped.</description>
		<content:encoded><![CDATA[<p>Thank you &#8230; this has me very helped.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iancho</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-502</link>
		<dc:creator>Iancho</dc:creator>
		<pubDate>Thu, 05 Nov 2009 13:42:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-502</guid>
		<description>Thanks for the tip.</description>
		<content:encoded><![CDATA[<p>Thanks for the tip.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ganymede</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-58</link>
		<dc:creator>ganymede</dc:creator>
		<pubDate>Tue, 02 Dec 2008 22:31:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-58</guid>
		<description>Thanks, the only guide that actually explained what I needed to do to fix the problem.</description>
		<content:encoded><![CDATA[<p>Thanks, the only guide that actually explained what I needed to do to fix the problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: T0aD</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-57</link>
		<dc:creator>T0aD</dc:creator>
		<pubDate>Tue, 25 Nov 2008 14:03:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-57</guid>
		<description>You may also have searched on Google for what to do about it and come away with very little useful information.

Next time try to read the manpage sshd_config(5)

&quot;     ChrootDirectory
             Specifies a path to chroot(2) to after authentication.  This
             path, and all its components, must be root-owned directories that
             are not writable by any other user or group.

&quot;</description>
		<content:encoded><![CDATA[<p>You may also have searched on Google for what to do about it and come away with very little useful information.</p>
<p>Next time try to read the manpage sshd_config(5)</p>
<p>&#8221;     ChrootDirectory<br />
             Specifies a path to chroot(2) to after authentication.  This<br />
             path, and all its components, must be root-owned directories that<br />
             are not writable by any other user or group.</p>
<p>&#8220;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cmsj</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-55</link>
		<dc:creator>cmsj</dc:creator>
		<pubDate>Mon, 17 Nov 2008 13:24:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-55</guid>
		<description>Geophphrie: I&#039;d use the #ifdef section to set a variable to contain the uid and then use one bit of code to check it, rather than duplicate the whole section.
Also I think you should file a bug about this, assuming that upstream care about windows.</description>
		<content:encoded><![CDATA[<p>Geophphrie: I&#8217;d use the #ifdef section to set a variable to contain the uid and then use one bit of code to check it, rather than duplicate the whole section.<br />
Also I think you should file a bug about this, assuming that upstream care about windows.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geophphrie</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-54</link>
		<dc:creator>Geophphrie</dc:creator>
		<pubDate>Tue, 11 Nov 2008 17:39:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-54</guid>
		<description>Thanks for posting this. Since you found the code section, I was able to easily identify and fix the problem using this feature under Cygwin: that the &quot;root&quot; (Administrators) user is uid 544, not 0. I had to compile OpenSSH, of course, but that was worthwhile given that there&#039;s really not another reasonable solution for sftp on Windows that doesn&#039;t cost $500+ (and also wouldn&#039;t integrate into the existing ssh install).

Note that I also adjusted the mode check NOT to check the actual chroot dir; it still checks the dirs leading up to it and requires root ownership still. I have no idea what the security implications of this change are, but it is sufficient for my purposes.

#ifdef HAVE_CYGWIN
        if (st.st_uid != 544 &#124;&#124; (cp != NULL &amp;&amp; (st.st_mode &amp; 022) != 0))
            fatal(&quot;bad ownership or modes for chroot &quot;
                &quot;directory %s\&quot;%s\&quot;&quot;,
                cp == NULL ? &quot;&quot; : &quot;component &quot;, component);
#endif
#ifndef HAVE_CYGWIN
        if (st.st_uid != 0 &#124;&#124; (st.st_mode &amp; 022) != 0)
            fatal(&quot;bad ownership or modes for chroot &quot;
                &quot;directory %s\&quot;%s\&quot;&quot;,
                cp == NULL ? &quot;&quot; : &quot;component &quot;, component);
#endif</description>
		<content:encoded><![CDATA[<p>Thanks for posting this. Since you found the code section, I was able to easily identify and fix the problem using this feature under Cygwin: that the &#8220;root&#8221; (Administrators) user is uid 544, not 0. I had to compile OpenSSH, of course, but that was worthwhile given that there&#8217;s really not another reasonable solution for sftp on Windows that doesn&#8217;t cost $500+ (and also wouldn&#8217;t integrate into the existing ssh install).</p>
<p>Note that I also adjusted the mode check NOT to check the actual chroot dir; it still checks the dirs leading up to it and requires root ownership still. I have no idea what the security implications of this change are, but it is sufficient for my purposes.</p>
<p>#ifdef HAVE_CYGWIN<br />
        if (st.st_uid != 544 || (cp != NULL &amp;&amp; (st.st_mode &amp; 022) != 0))<br />
            fatal(&#8220;bad ownership or modes for chroot &#8221;<br />
                &#8220;directory %s\&#8221;%s\&#8221;",<br />
                cp == NULL ? &#8220;&#8221; : &#8220;component &#8220;, component);<br />
#endif<br />
#ifndef HAVE_CYGWIN<br />
        if (st.st_uid != 0 || (st.st_mode &amp; 022) != 0)<br />
            fatal(&#8220;bad ownership or modes for chroot &#8221;<br />
                &#8220;directory %s\&#8221;%s\&#8221;",<br />
                cp == NULL ? &#8220;&#8221; : &#8220;component &#8220;, component);<br />
#endif</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-53</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Mon, 10 Nov 2008 15:38:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-53</guid>
		<description>Wow... thanks for the hint -- appreciate you taking the time to dig for the answer. :-)</description>
		<content:encoded><![CDATA[<p>Wow&#8230; thanks for the hint &#8212; appreciate you taking the time to dig for the answer. :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Webagentur</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-52</link>
		<dc:creator>Webagentur</dc:creator>
		<pubDate>Wed, 05 Nov 2008 15:30:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-52</guid>
		<description>What is that for a tutorial?</description>
		<content:encoded><![CDATA[<p>What is that for a tutorial?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cmsj</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-51</link>
		<dc:creator>cmsj</dc:creator>
		<pubDate>Thu, 30 Oct 2008 20:32:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-51</guid>
		<description>Marko: you can&#039;t do that with the current code. Move your 777 directory inside root:root 644 directory and chroot into that one.</description>
		<content:encoded><![CDATA[<p>Marko: you can&#8217;t do that with the current code. Move your 777 directory inside root:root 644 directory and chroot into that one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marko</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-50</link>
		<dc:creator>Marko</dc:creator>
		<pubDate>Wed, 22 Oct 2008 19:17:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-50</guid>
		<description>Hey,

but what if I want to have permissions ChrootDirectory set to e.g. 777? The manual suggests I set &quot;StrictModes&quot; to &quot;no&quot;, but that didn&#039;t work - I still get the same error (bad ownership...)

Thanks,

Marko</description>
		<content:encoded><![CDATA[<p>Hey,</p>
<p>but what if I want to have permissions ChrootDirectory set to e.g. 777? The manual suggests I set &#8220;StrictModes&#8221; to &#8220;no&#8221;, but that didn&#8217;t work &#8211; I still get the same error (bad ownership&#8230;)</p>
<p>Thanks,</p>
<p>Marko</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cmsj</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-49</link>
		<dc:creator>cmsj</dc:creator>
		<pubDate>Mon, 13 Oct 2008 13:10:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-49</guid>
		<description>Yeah, Minstrel&#039;s information about this is very useful, I recommend reading that stuff :)</description>
		<content:encoded><![CDATA[<p>Yeah, Minstrel&#8217;s information about this is very useful, I recommend reading that stuff :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Minstrel</title>
		<link>http://www.tenshu.net/archives/2008/10/09/openssh-51-chrootdirectory-permissions-issue/comment-page-1/#comment-48</link>
		<dc:creator>Minstrel</dc:creator>
		<pubDate>Fri, 10 Oct 2008 04:39:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=236#comment-48</guid>
		<description>Good to see solutions being published to this kind of problem - there are a few others on my Web page at:

http://www.minstrel.org.uk/papers/sftp/

I hope this helps as well.

--
Minstrel</description>
		<content:encoded><![CDATA[<p>Good to see solutions being published to this kind of problem &#8211; there are a few others on my Web page at:</p>
<p><a href="http://www.minstrel.org.uk/papers/sftp/" rel="nofollow">http://www.minstrel.org.uk/papers/sftp/</a></p>
<p>I hope this helps as well.</p>
<p>&#8211;<br />
Minstrel</p>
]]></content:encoded>
	</item>
</channel>
</rss>
