<?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>Keep [C]*(od&#124;do)ing &#187; ssh</title>
	<atom:link href="http://liwen.name/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://liwen.name</link>
	<description>Grow with the flow</description>
	<lastBuildDate>Fri, 10 Jul 2009 19:37:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Password-less svn+ssh Access on Mac OS X &#8211; Updated</title>
		<link>http://liwen.name/2009/05/passwordless-svnssh-access-on-mac-os-x/</link>
		<comments>http://liwen.name/2009/05/passwordless-svnssh-access-on-mac-os-x/#comments</comments>
		<pubDate>Sun, 03 May 2009 20:57:04 +0000</pubDate>
		<dc:creator>Liwen</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[macos]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://liwen.name/?p=272</guid>
		<description><![CDATA[Related Posts: 1. Install Subversion 1.5.5 on Bluehost Linux 64bit Box 2. Configure svn+ssh on Windows OS After relentless pounding of my fingers on the keyboard just to feed the same password again and again and again to subversion repository in Mac terminal, I realised that typing password is not as fun as developing finger [...]]]></description>
			<content:encoded><![CDATA[<p>Related Posts:</p>
<p>1. <a href="http://liwen.name/2009/02/bluehost-subversion-windows-cmd/">Install Subversion 1.5.5 on Bluehost Linux 64bit Box</a><br />
2. <a href="http://liwen.name/2009/02/configure-svnssh-on-windows/">Configure svn+ssh on Windows OS</a></p>
<p>After relentless pounding of my fingers on the keyboard just to feed the same password again and again and again to subversion repository in Mac terminal, I realised that typing password is not as fun as developing finger habits in my beloved Emacs, although they are both repetitive. </p>
<p>I was reluctant to set up password-less svn+ssh access on my new Mac machine. The reason is that the key pair I am using were both generated by <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" rel="external">Putty</a>, one deployed on Linux server and one for Windows clients. I would rather play Street Fight 4 online for half hour other than reconfigure SSH access across three different operating systems &#8211; if it is not absolutely necessary. They both involve the phrase “pain in the ass”, if you know what I mean :) </p>
<p>Good news is that Mac OS comes with a SSH agent:</p>
<blockquote><p>ssh-agent is a program to hold private keys used for public key authentication (RSA, DSA). The idea is that ssh-agent is started in the beginning of an X-session or a login session, and all other windows or programs are started as clients to the ssh-agent program.  </p></blockquote>
<p>With the ssh agent, we can add the identity once per login. It means &#8216;add once, use everywhere&#8217;! It will be really helpful if you use more than one clients to connect to the same repository server.</p>
<p>Step1:<br />
Use mac os build in <a href="http://developer.apple.com/documentation/Darwin/Reference/Manpages/man1/ssh-keygen.1.html#//apple_ref/doc/man/1/ssh-keygen" rel="external">ssh-keygen</a> to generate a pair of openssh format keys. Deploy the public key on your server (assume your server uses openssh) and set up the appropriate permissions (see the related post1 to lean more). If you already have a .ppk key, then a conversion from Putty format to openssh would probably be the easiest way to go. It can be done either using  <a rel="external"  href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">PuttyGen</a> in Windows OS or using a Putty Mac port (<a href="http://www.macports.org/" rel="external">MacPorts</a> or <a href="http://putty.darwinports.com/" rel="external">DawinPorts</a>). </p>
<p>Step2:<br />
Grant the key file minimum permissions. It needs to be:<br />
<code>chmod u=r,ga-rwx</code> </p>
<p>If you are curious about ssh agent, read step3 and step4, otherwise, just skip to step 5.</p>
<p><del datetime="2009-05-16T10:15:11+00:00">Step3:<br />
Find out the ssh-agent environment variable values: <code>SSH_AUTH_SOCK</code> and <code>SSH_AGENT_PID</code>. For more info about ssh agent in Mac OS, please <a href="http://developer.apple.com/documentation/Darwin/Reference/Manpages/man1/ssh-agent.1.html" rel="external">read here</a>.</del></p>
<p><img src="http://liwen.name/images/blog/mac_ssh_agent.jpg" alt="Mac OS SSH agent" /></p>
<p>Step4:<br />
<del datetime="2009-05-04T12:09:26+00:00">Set <code>SSH_AUTH_SOCK</code> and <code>SSH_AGENT_PID</code> environment variables in your subversion client of choice. If you only use command line clients, this step can be skipped.</del><br />
Update: It turned out the <code>SSH_AGENT_PID</code> value changes form login to login. </p>
<blockquote><p><code>/tmp/ssh-XXXXXXXXXX/agent.&lt;ppid&gt;</code><br />
Unix-domain sockets used to contain the connection to the authentication agent.  These sockets should only be readable by the owner.  The sockets should get automatically removed when the agent exits.</p></blockquote>
<p>In this case, the clients need to talk to the OS to find out the value. Since ssh-agent servers as a lower level service in the OS, it seems to be impossible to set up those values for clients manually and I assume it is not necessary.</p>
<p>Setp5:<br />
<del datetime="2009-05-04T12:09:26+00:00">Use ssh-add command to add the key to ssh authentication agent.<br />
<code>ssh-add yourkey</code></del></p>
<p>Find the following three files in the ~/.ssh/ directory (create if not exist).</p>
<blockquote>
<pre>
 ~/.ssh/identity
    Contains the protocol version 1 RSA authentication identity of the user.
 ~/.ssh/id_dsa
    Contains the protocol version 2 DSA authentication identity of the user.
 ~/.ssh/id_rsa
    Contains the protocol version 2 RSA authentication identity of the user.
</pre>
</blockquote>
<p>Append your private key in the right file (depends on the key type) and change the permission to <strong>owner read only</strong>, the ssh-agent will automatically read those files and add identities to the agent every time a ssh request occurs.</p>
<p>Now it&#8217;s really password-less!</p>
<p><img src="http://liwen.name/images/blog/mac_ssh_add.jpg" alt="Mac ssh-add command" /></p>
]]></content:encoded>
			<wfw:commentRss>http://liwen.name/2009/05/passwordless-svnssh-access-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configure svn+ssh on Windows</title>
		<link>http://liwen.name/2009/02/configure-svnssh-on-windows/</link>
		<comments>http://liwen.name/2009/02/configure-svnssh-on-windows/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 20:52:58 +0000</pubDate>
		<dc:creator>Liwen</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=40</guid>
		<description><![CDATA[As a proud command line junkie, I never went anywhere without my Emacs ssettings, which made my hands look like old branches from dead tree in some desert, but that&#8217;s fine for me, it&#8217;s been a decade since I ceased my hand moulding career. Ok It&#8217;s a lie but seriously, I am not a big [...]]]></description>
			<content:encoded><![CDATA[<p>As a proud command line junkie, I never went anywhere without my <a rel="external"  href="http://www.gnu.org/software/emacs/">Emacs</a> ssettings, which made my hands look like old branches from dead tree in some desert, but that&#8217;s fine for me, it&#8217;s been a decade since I ceased my hand moulding career.</p>
<p>Ok It&#8217;s a lie but seriously, I am not a big fan of mice and GUI, they usually slow me down and distract me from concentrating. Besides, some really bad designed HCI, such as <a rel="external" href="http://technet.microsoft.com/en-us/library/cc709628.aspx">Windows Vista UAC</a>, can easily push my buttons in all circumstances. People from Microsoft said </p>
<blockquote><p>“Disabling UAC risks your computer for allowing some worms to execute commands secretly without a prompt confirmation from end user.”</p></blockquote>
<p>and I up voted this as the correct answer: </p>
<blockquote><p>“Enabling UAC risks me throwing my computer out the window from frustration with a poorly designed and horribly executed security model.”</p></blockquote>
<p>Forgive me being loquacious, the point here is I don’t want to use <a rel="external" href="http://tortoisesvn.tigris.org/">TortoiseSVN</a> &#8211; I 100% agree with you that it&#8217;s a fantastic software, I do! I just need to get svn+ssh work with my Emacs shell mode.</p>
<p>Let&#8217;s get started.</p>
<p>1. Download <a rel="external" href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">Putty</a>, if you are like me always afraid of installing untrusted software from the Internet because you believe that they are mostly badly written piece of crap that they would mess your already rubbished Windows OS completely then you can be greatly relieved here, I promise.</p>
<p>2. Start <code>Puttygen.exe</code> and generate a pair of keys, save the private key <strong>WITHOUT</strong> passcode,</p>
<p>3. Copy the public key, yes <strong>COPY</strong> not <strong>SAVE</strong>, paste/append it to <code>$HOME/.ssh/authorized_keys</code>, create the file if it doesn&#8217;t exist.</p>
<p>4. After modified the <code>authorized_keys</code> file, remember to:</p>
<p><code>chmod 700 authorized_keys<br />
chmod 600 .ssh</code></p>
<p>This is important as you may get connection errors if the file is group writable.</p>
<p>5. Next, test the connection with <code>putty.exe</code> or <code>plink.exe</code>, (side note:TortoiseSVN has a <code>plink.exe</code> windows implementation which would not pop up messages.)<br />
<code>plink.exe -i theprivatekey.ppk username@hostname </code></p>
<p>6. Modify your subversion configuration file. It&#8217;s in<br />
<code>c:\Users\yourname\AppData\Roaming\Subversion</code> in Windows Vista<br />
add the following line to your <code>[tunnels]</code> section:<br />
<code>ssh=x:/path/plink.exe -i x:/path/privatekey.ppk</code></p>
<p>Now you should be able to access your svn+ssh repository without typing password, in Microsoft Windows! Vista!</p>
<p>Some extra info for folks who love GUI – for TortoiseSVN users, you need to generate the OpenSSH private key from server, then load it with puttygen.exe and get the public key – it’s due to the fact that there are differences between private key implementations in putty and OpenSSH, otherwise you will get the lovely “server refused our key” message!</p>
]]></content:encoded>
			<wfw:commentRss>http://liwen.name/2009/02/configure-svnssh-on-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Install Subversion 1.5.5 on Bluehost 64bit Box</title>
		<link>http://liwen.name/2009/02/bluehost-subversion-windows-cmd/</link>
		<comments>http://liwen.name/2009/02/bluehost-subversion-windows-cmd/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 23:55:18 +0000</pubDate>
		<dc:creator>Liwen</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[bluehost]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=20</guid>
		<description><![CDATA[The first thing I do before start typing code at home is to put it under version control system; the first thing I tried to do when had a SSH enabled reliable hosting, of course, was to set up Subversion server on it. There are already several tutorials in the Internet, why I am writing [...]]]></description>
			<content:encoded><![CDATA[<p>The first thing I do before start typing code at home is to put it under version control system; the first thing I tried to do when had a SSH enabled reliable hosting, of course, was to set up Subversion server on it.</p>
<p>There are already several tutorials in the Internet, why I am writing this again? Well, I just wanted to prove that I too, can write blog!  Among all those tutorials, none of them worked for me, I guess either I was trying to install the newest version of SVN or the BlueHost hosting environment has changed, or they just hate me. So I am constructing this and hope to contribute something I learned along the frustrating process of setting up SVN on 64bit shared hosting so you don’t need to smash your keyboard.</p>
<p>Once you enabled SSH on BlueHost control panel with a photo ID, it’s time to set up Subversion.</p>
<p>1. Open a terminal, type in:<br />
<code>ssh username@yourdomain.com</code><br />
and hit enter, then input your hosting password.</p>
<p>2. It’s better to create a separate folder for all the operations, in case our home directories got messed up by any mistakes.</p>
<p><code>mkdir src<br />
cd src</code></p>
<p>3. Download Subversion and dependencies:</p>
<p><code>wget http://subversion.tigris.org/downloads/subversion-1.5.5.tar.gz<br />
wget http://subversion.tigris.org/downloads/subversion-deps-1.5.5.tar.gz<br />
tar -xzvf subversion-1.5.5.tar.gz<br />
tar -xzvf subversion-deps-1.5.5.tar.gz<br />
cd subversion-1.5.5</code></p>
<p>4. Install <code>apr</code> and <code>apr-util</code>, notice the var <code>LDFLAGS</code> , it&#8217;s 64 bit, it&#8217;s m-A-g-I-c.</p>
<p><code>cd apr<br />
./configure --enable-shared --prefix=$HOME LDFLAGS="-L/lib64"<br />
make &#038;&#038; make install</code></p>
<p><code>cd ../apr-util<br />
./configure --enable-shared --prefix=$HOME<br />
--with-apr=$HOME --without-berkeley-db LDFLAGS="-L/lib64"<br />
make &#038;&#038; make install</code></p>
<p>5. Install <code>neon</code>, I had been stuck here for an hour because of the 64 bit mode problem, remember to explicitly enable compilation of shared libraries and prefix the files into home directory.</p>
<p><code>cd ../neon<br />
EXTRA_CFLAGS="-L/lib64 -fPIC"<br />
CFLAGS="-L/lib64 -fPIC"<br />
./configure --prefix=$HOME --enable-shared LDFLAGS="-L/lib64" --with-libs=$HOME<br />
make &#038;&#038; make install</code></p>
<p>6. Install Subversion, pass <code>--without-apxs</code> and -<code>-without-apache</code> to prevent svn installing Apach modules, also you need to explicitly specify the dependencies.</p>
<p><code>cd ../<br />
./configure --prefix=$HOME --without-berkeley-db --with-apr=$HOME --with-apr-util=$HOME --with-neon=$HOME<br />
-without-apxs --without-apache<br />
make &#038;&#038; make install</code></p>
<p>7. Modify <code>.bash_profile</code> and <code>.bashrc</code> file</p>
<p><code>nano -w .bash_profil</code>e (pico is always my favourite.)<br />
add <code>$HOME/system/bin</code> to <code>PATH</code> variable, it should look like this:<br />
<code>PATH=$PATH:$HOME/bin:$HOME/system/bin</code><br />
Also add this line to your <code>.bashrc</code> file, after the &#8216;<code>fi</code>&#8216;<br />
PATH=$PATH:$HOME/bin</p>
<p>8. Logout the current session and log on again, let’s try:<br />
<code>mkdir ~/repos<br />
cd repos<br />
svnadmin create topsecrets007plus</code></p>
<p>now you can access your repository like this:<br />
<code>svn+ssh://username@host/home/username/repos/topsecrets007plus/</code><br />
just replace username with your 8-character user name given by BlueHost.</p>
]]></content:encoded>
			<wfw:commentRss>http://liwen.name/2009/02/bluehost-subversion-windows-cmd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
