<?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>LlamaLabs &#187; SSH</title>
	<atom:link href="http://llamalabs.com/category/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://llamalabs.com</link>
	<description>Wisdom of the llama</description>
	<lastBuildDate>Thu, 03 Feb 2011 09:54:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using ssh-agent for password-less ssh access</title>
		<link>http://llamalabs.com/2008/03/31/using-ssh-agent-for-password-less-ssh-access/</link>
		<comments>http://llamalabs.com/2008/03/31/using-ssh-agent-for-password-less-ssh-access/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 07:19:19 +0000</pubDate>
		<dc:creator>kanske</dc:creator>
				<category><![CDATA[SSH]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[password-less]]></category>
		<category><![CDATA[ssh-agent]]></category>

		<guid isPermaLink="false">http://llamalabs.com/2008/03/31/using-ssh-agent-for-password-less-ssh-access/</guid>
		<description><![CDATA[Instead of typing in the password to decrypt my private SSH key every time I want to ssh to a host I use a program called ssh-agent, which is included in the openssh-clients package in CentOS. When you run ssh-agent it creates a long-running process that holds decrypted keys and spits out some environment variables [...]]]></description>
			<content:encoded><![CDATA[<p>Instead of typing in the password to decrypt my private SSH key every time I want to ssh to a host I use a program called ssh-agent, which is included in the openssh-clients package in CentOS.</p>
<p>When you run ssh-agent it creates a long-running process that holds decrypted keys and spits out some environment variables that the ssh client can use:</p>
<pre>SSH_AUTH_SOCK=/tmp/ssh-Ksfjq28070/agent.28070; export SSH_AUTH_SOCK;
SSH_AGENT_PID=28071; export SSH_AGENT_PID;
echo Agent pid 28071;</pre>
<p>The problem is that you want to have those environment variables sourced in when you open new terminal windows. I added the following to my .profile to write those lines out to a file so they could be sourced in easily.</p>
<pre>test -e ~/.ssh_agent &amp;&amp; . ~/.ssh_agent
need_to_start_ssh_agent="0"
if test "" != "$SSH_AGENT_PID" ; then
  /bin/ps -p $SSH_AGENT_PID | /usr/bin/grep ssh-agent &gt; /dev/null
  res=$?
  if test "1" == "$res" ; then
    echo "ssh-agent is not running. We need to start the agent"
    need_to_start_ssh_agent="1"
  else
    echo "ssh-agent running - pid: $SSH_AGENT_PID"
  fi
else
  echo "ssh-agent is not running. We need to start the agent"
  need_to_start_ssh_agent="1"
fi</pre>
<pre>if test "1" == "$need_to_start_ssh_agent" ; then
  `which ssh-agent` | grep -v echo &gt; ~/.ssh_agent
  . ~/.ssh_agent
  `which ssh-add`
fi</pre>
<p>After using this for a while I found Daniel Robbin&#8217;s article about his keychain utility <a href="http://www.ibm.com/developerworks/library/l-keyc2/">http://www.ibm.com/developerworks/library/l-keyc2/</a>. It&#8217;s basically a more-refined version of my addition to .profile. I&#8217;m still going to stick with my solution for now because it&#8217;s so lightweight.</p>
]]></content:encoded>
			<wfw:commentRss>http://llamalabs.com/2008/03/31/using-ssh-agent-for-password-less-ssh-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

