<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.2" -->
<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/"
>

<channel>
	<title>Articles</title>
	<link>http://www.antidis.com/articles</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Mon, 26 May 2008 09:16:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.2</generator>
	<language>en</language>

		<item>
		<title>rsync on Windows, with Strongspace</title>
		<link>http://www.antidis.com/articles/2005/08/windows-rsync/</link>
		<comments>http://www.antidis.com/articles/2005/08/windows-rsync/#comments</comments>
		<pubDate>Mon, 22 Aug 2005 16:45:23 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
		
	<category>Tips and Tricks</category>
		<guid>http://www.antidis.com/articles/2005/08/windows-rsync/</guid>
		<description><![CDATA[If you're on Windows, and you'd like to be able to use rsync with your Strongspace account, read on. This article will show you how to install and configure rsync on your Windows machine, and how to set up SSH keys on Strongspace so that you don't need to type in your password every time [...]]]></description>
			<content:encoded><![CDATA[<p>If you're on Windows, and you'd like to be able to use rsync with your Strongspace account, read on. This article will show you how to install and configure rsync on your Windows machine, and how to set up SSH keys on Strongspace so that you don't need to type in your password every time you use rsync. It assumes you're running a decent version of Windows, namely Windows XP, Windows Server 2003 or Windows 2000. I've tested it with Windows XP SP2.</p>

<a id="more-1"></a>

<style type="text/css" media="screen">@import "/css/articles/windows-rsync/title.css";</style>

<p>Thanks go to <a href="http://www.minds.nuim.ie/~philb/serendipity/" title="Phil Brennan's blog">Phil Brennan</a> for telling me about the particular build of rsync used here, both Phil and <a href="http://www.minds.nuim.ie/~dez/serendipity/" title="Des Traynor's blog">Des Traynor</a> for proof reading, and Marten Veldthuis for helping to fix some technical errors.</p>

<h2>Installing rsync</h2>

<p>You need to download a Windows version of rsync. The best one I've found, in that <em>it works</em>, is called <a href="http://tinyurl.com/2gae3" title="The cwRsync homepage">cwRsync</a>. You can <a href="http://tinyurl.com/7gs4j" title="Download cwRsync from Sourceforge">download the installer from Sourceforge</a>.</p>

<div class="img-side"><img src="http://antidis.com/articles/pics/windows-rsync/extract-installer.jpg" alt="" /><div class="caption">Extracting the rsync installer to your desktop.</div></div>

<p>The installer is contained inside the zip file. You'll need to extract the installer before you can use it. Go to where you have downloaded the zip file, right-click on it and choose "Extract all...". A dialogue box will pop up; just click <em>Next</em>, <em>Next</em> and <em>Finish</em>.</p>

<p>Open up the new folder and double-click the installer. It's pretty standard stuff - if you've ever installed a Windows program before, you shouldn't have any problems. I recommend you install it into <tt>c:\cwRsync</tt>; the default location of <tt>c:\Program Files\cwRsync</tt> can cause some odd problems. For the rest of the article, I'm going to assume you've installed it to <tt>c:\cwRsync</tt>.</p>

<p>rsync is now installed. Now let's set up some environment variables to make everything work.</p>

<h2>Configuring rsync</h2>

<p>Go to the Control Panel and open up <em>System</em> (if you're not using the classic view, you can find it in the <em>Performance and Maintenance</em> section). Click on the <em>Advanced</em> tab, and at the bottom you should see a button labelled <em>Environment Variables</em>. Click on it.</p>

<p>You need to set up two environment variables. Firstly, you need to add the directory <tt>c:\cwRsync\bin</tt> to your path. You can do this by creating a new user environment variable called <tt>PATH</tt> and giving it the value <tt>c:\cwRsync\bin;%PATH%</tt>.</p>

<div class="img-insert"><img src="http://antidis.com/articles/pics/windows-rsync/new-user-env-var.png" alt="" /><div class="caption">Click the top &ldquo;New...&rdquo; button to add a new user environment variable.</div></div>

<div class="img-insert"><img src="http://antidis.com/articles/pics/windows-rsync/adding-path.png" alt="" /><div class="caption">Adding <tt>c:\cwRsync\bin</tt> to your path.</div></div>

<p>In the same way, you need to add another user environment variable called <tt>RSYNC_RSH</tt> with the value <tt>ssh.exe</tt>. When you are finished, you should see something like this:</p>

<div class="img-insert"><img src="http://antidis.com/articles/pics/windows-rsync/all-env-variables.png" alt="" /><div class="caption">Both environment variables have been added.</div></div>

<p>If you do, click OK twice and move on. If not, <a href="#respond" title="The comments form for this article">leave a comment</a> and I'll try to help.</p>

<h2>Testing</h2>

<p>Open up a command prompt with "Start", "Run..." and "cmd". Run the commands below, changing <em>username</em> to your Strongspace username and <em>subdomain</em> to your Strongspace subdomain. This command will create a directory called <tt>testrsync</tt> in your Strongspace, and upload the directory <tt>c:\cwRsync</tt> to it using rsync.</p>

<ol class="code">
  <li>cd c:\</li>
  <li>rsync -avz --delete &quot;/cwRsync&quot; username@subdomain.strongspace.com:testrsync</li>
</ol>

<div class="warning">
    <strong>Warning!</strong> If you already have a directory called <tt>testrsync/cwRsync</tt> in the Home directory of your Strongspace account, then this command will delete the contents of it. This is how the <tt>--delete</tt> switch works. The details of how rsync works is beyond the scope of this article.
</div>

<p>You'll be asked if you want to continue connection (type "yes" and hit enter) and then asked for your Strongspace password. Type that, hit enter, and you should see files begin to upload. Login to Strongspace and make sure the files from <tt>c:\cwRsync</tt> are there. If so, rsync is now working! If not, <a href="#respond" title="The comments form for this article">leave a comment</a>.</p>

<h2>Making your SSH keys</h2>

<p>If you don't want to provide a password every time you use rsync, you can set up SSH keys. There's a good explanation of what these are at <a href="http://the.earth.li/~sgtatham/putty/0.55/htmldoc/Chapter8.html#S8.1" title="Using public keys for SSH authentication">the PuTTY page on using public key authentication</a>.</p>

<p>Make a new folder in your Strongspace Home account, named &quot;.ssh&quot;. Open a new command prompt. You should be in your home directory (in my case, <tt>C:\Documents and Settings\David Barrett</tt>). If not, <tt>cd</tt> to it. Then run the following commands:</p>

<ol class="code">
  <li>ssh-keygen -P &quot;&quot; -t dsa</li>
  <li>cd .ssh</li>
  <li>copy id_dsa.pub authorized_keys</li>
  <li>cd ..</li>
  <li>rsync -avz &quot;.ssh/authorized_keys&quot; username@subdomain.strongspace.com:.ssh/authorized_keys</li>
  <li>del .ssh/authorized_keys</li>
</ol>

<p>Now you don't need to type your password to use rsync.</p>]]></content:encoded>
			<wfw:commentRSS>http://www.antidis.com/articles/2005/08/windows-rsync/feed/</wfw:commentRSS>
	</item>
	</channel>
</rss>
