<?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>Ivan Villareal &#187; Setting up ssh keys for passwordless login &#8211; Ivan Villareal</title>
	<atom:link href="http://ivanvillareal.com/tag/auth/feed/" rel="self" type="application/rss+xml" />
	<link>http://ivanvillareal.com</link>
	<description>IT stuff and more...</description>
	<lastBuildDate>Tue, 01 Nov 2011 23:00:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting up ssh keys for passwordless login</title>
		<link>http://ivanvillareal.com/linux/setting-up-ssh-keys-for-passwordless-login/</link>
		<comments>http://ivanvillareal.com/linux/setting-up-ssh-keys-for-passwordless-login/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 23:57:29 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[auth]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[passwordless]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://ivanvillareal.com/?p=40</guid>
		<description><![CDATA[Most part of the time I&#8217;ve spent on my development machine I have several terminals opened, but thanks to screen I only have one per server. However I&#8217;m constantly in [...]]]></description>
			<content:encoded><![CDATA[<p>Most part of the time I&#8217;ve spent on my development machine I have several terminals opened, but thanks to <a title="Screen is a full-screen window manager that multiplexes a physical terminal between several processes" href="http://www.gnu.org/software/screen/" target="_blank">screen </a>I only have one per server.</p>
<p>However I&#8217;m constantly in the need to login to some servers just to make a quick check of something, so I have to type in my credentials every time I log in, this really annoys me, because when I&#8217;m focused on something I don&#8217;t want to loose that focus waiting for the login prompt.</p>
<p>So what I did &nbsp;to fix this annoyance, was to use Key Authentication &nbsp;instead of Password Authentication, I&#8217;ve been using this for several years now under several distros&nbsp;without&nbsp;a problem.</p>
<p>So in short this is what I do, whenever I want to use Key Auth.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gondor .ssh <span style="color: #666666; font-style: italic;"># cd ~/.ssh</span>
gondor .ssh ~ <span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span>
Generating public<span style="color: #000000; font-weight: bold;">/</span>private rsa key pair.
Enter <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #c20cb9; font-weight: bold;">which</span> to save the key <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa<span style="color: #7a0874; font-weight: bold;">&#41;</span>:
Enter passphrase <span style="color: #7a0874; font-weight: bold;">&#40;</span>empty <span style="color: #000000; font-weight: bold;">for</span> no passphrase<span style="color: #7a0874; font-weight: bold;">&#41;</span>:
Enter same passphrase again:
Your identification has been saved <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.
Your public key has been saved <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub.
The key fingerprint is:
<span style="color: #000000;">53</span>:<span style="color: #c20cb9; font-weight: bold;">df</span>:bb:<span style="color: #000000;">74</span>:<span style="color: #000000;">24</span>:2d:7f:<span style="color: #000000;">78</span>:1f:<span style="color: #000000;">85</span>:<span style="color: #000000;">66</span>:f0:<span style="color: #000000;">19</span>:b6:9f:<span style="color: #000000;">71</span> root<span style="color: #000000; font-weight: bold;">@</span>gondor
The key<span style="color: #ff0000;">'s randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|          . . o  |
|         . . = * |
|        S   . @.E|
|         .   o O=|
|              +o*|
|             . ++|
|              . .|
+-----------------+</span></pre></div></div>

<p>I haven&#8217;t set a password for the key, &nbsp;because if I set a password I would have to type the password for the key each time, or setup a program to remember the key password like Gnome Keyring or Putty Pageant in Windows.</p>
<p>After my private and public keys are generated I copy the public key to the server where I want to access&nbsp;without&nbsp;password</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gondor .ssh <span style="color: #666666; font-style: italic;"># ssh-copy-id -i id_rsa.pub ivan@odin</span>
The authenticity of host <span style="color: #ff0000;">'odin (192.168.1.201)'</span> can<span style="color: #ff0000;">'t be established.
RSA key fingerprint is bb:36:b4:0b:05:13:ce:a2:2e:95:97:59:65:f3:f8:a8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '</span>odin,192.168.1.201<span style="color: #ff0000;">' (RSA) to the list of known hosts.
Password:</span></pre></div></div>

<p>Now try logging into the machine, with &#8220;ssh &#8216;ivan@odin&#8217;&#8221;, and check in:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  .ssh<span style="color: #000000; font-weight: bold;">/</span>authorized_keys</pre></div></div>

<p>to make sure we haven&#8217;t added extra keys that you weren&#8217;t expecting.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gondor .ssh <span style="color: #666666; font-style: italic;"># ssh ivan@odin</span>
Last <span style="color: #c20cb9; font-weight: bold;">login</span>: Fri Sep <span style="color: #000000;">25</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">50</span>:03 PDT <span style="color: #000000;">2009</span> from gondor.artedigital on <span style="color: #c20cb9; font-weight: bold;">ssh</span>
Last <span style="color: #c20cb9; font-weight: bold;">login</span>: Fri Sep <span style="color: #000000;">25</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">50</span>:07 <span style="color: #000000;">2009</span> from gondor.artedigital
ivan<span style="color: #000000; font-weight: bold;">@</span>odin ~ $</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://ivanvillareal.com/linux/setting-up-ssh-keys-for-passwordless-login/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

