<?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>kgx.net.nz &#187; Programming</title>
	<atom:link href="http://www.kgx.net.nz/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kgx.net.nz</link>
	<description></description>
	<lastBuildDate>Mon, 30 May 2011 10:46:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Cygwin, sshd and Windows 7</title>
		<link>http://www.kgx.net.nz/2010/03/cygwin-sshd-and-windows-7/</link>
		<comments>http://www.kgx.net.nz/2010/03/cygwin-sshd-and-windows-7/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 03:58:30 +0000</pubDate>
		<dc:creator>kgx</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[openssh]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sshd]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows7]]></category>

		<guid isPermaLink="false">http://www.kgx.net.nz/?p=86</guid>
		<description><![CDATA[It seems like installing OpenSSH (sshd) on Windows 7 is a bit of a hassle. When I first upgraded to 7 from WinXP, I simply copied across my Cygwin directory and it just worked. However, it was later I realised that it would not let me log in if using public key authentication. So I [...]]]></description>
			<content:encoded><![CDATA[<p>It seems like installing OpenSSH (sshd) on Windows 7 is a bit of a hassle. When I first upgraded to 7 from WinXP, I simply copied across my Cygwin directory and it just worked. However, it was later I realised that it would not let me log in if using public key authentication. So I decided to install it from scratch. I&#8217;ve always used <a href="http://pigtail.net/LRP/printsrv/cygwin-sshd.html" target="_blank">Nicholas Fong&#8217;s article</a> when installing openssh as the procedure  is quick and painless. But this is when I realised Windows 7 requires the sshd user to have extra privileges to get it work properly. The steps in the aforementioned site gets around this creating a new user called cyg_server. Personally, I don&#8217;t like having extra users, so I tried to find out how to give myself the same permissions without the need to create a new user.</p>
<p>With these instructions, you can fix the public key authentication problem and run sshd as Administrator or an existing user (even your own user account):</p>
<ol>
<li>You should have already installed cygwin and openssh by now. If not, what are you waiting for? Christmas? <img src='http://www.kgx.net.nz/wp-includes/images/smilies/icon_razz.png' alt=':P' class='wp-smiley' /> </li>
<li>Undo any previous attempts to install the sshd service:
<pre>$ net stop sshd
$ cygrunsrv -R sshd
$ net user sshd /DELETE  # See note below
$ rm -R /etc/ssh*
$ mkpasswd -cl &gt; /etc/passwd
$ mkgroup --local &gt; /etc/group
</pre>
<p><strong>#</strong> Run `net user` to find out if there&#8217;s any other such users that could have run sshd &#8211; example &#8220;sshd&#8221; or &#8220;cyg_server&#8221;. Delete these as well. Don&#8217;t delete any default Windows ones!</li>
<li>Decide on a user account that you want to run the sshd process. This can Administrator as well except its disabled on Windows 7 by default (it can be enabled by running lusrmgr.msc). For these instructions, lets say you want a user called MyUser to run sshd.</li>
<li>Check existing permissions for MyUser (in case you need to roll back, keep a note of its output):
<pre>$ editrights -l -u MyUser</pre>
</li>
<li>Add additional privileges to allow sshd to run as a service:
<pre>$ editrights.exe -a SeAssignPrimaryTokenPrivilege -u MyUser
$ editrights.exe -a SeCreateTokenPrivilege -u MyUser
$ editrights.exe -a SeTcbPrivilege -u MyUser
$ editrights.exe -a SeServiceLogonRight -u MyUser
</pre>
</li>
<li>Run ssh-host-config (don&#8217;t force the -y option):
<pre>$ ssh-host-config</pre>
</li>
<li>Answer yes to all questions making sure when it asks &#8220;Do you want to use a different name?&#8221;, say &#8220;yes&#8221; (this question is different with the -y option)</li>
<li>Enter your desired username and password when you are prompted. You should *not* see any warnings. If you do, you might not have set all privileges correctly</li>
<li>If all goes well, start sshd:
<pre>$ net start sshd</pre>
</li>
</ol>
<p>Disclaimer: Do this at your risk. Since your user gets these additional permissions, it may cause a few security issues (I can&#8217;t see any major issues though). You can find more information on user privileges at <a href="http://technet.microsoft.com/en-us/library/dd277311.aspx" target="_blank">Microsoft Technet</a>. Tested only on Cygwin 1.7.1 and Windows 7 Professional (64 bit).</p>
<p>PS: For those that are curious, the cygwin scripts that automatically made the new users were <span style="color: #888888;"><em>/usr/share/csih/cygwin-service-installation-helper.sh</em></span> and <span style="color: #888888;"><em>/usr/bin/ssh-host-config</em></span>. Looking through those scripts made it obvious what the problem was (Function: <em>csih_account_has_necessary_privileges()</em>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kgx.net.nz/2010/03/cygwin-sshd-and-windows-7/feed/</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.130 seconds -->

