<?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>Sentient Intelligence</title>
	<atom:link href="http://sentientintelligence.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://sentientintelligence.com</link>
	<description>Technical posts about things that i come across as a sysadmin</description>
	<lastBuildDate>Fri, 07 Aug 2009 09:26:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SSH keys for remote access</title>
		<link>http://sentientintelligence.com/?p=3</link>
		<comments>http://sentientintelligence.com/?p=3#comments</comments>
		<pubDate>Fri, 07 Aug 2009 09:18:42 +0000</pubDate>
		<dc:creator>bhowmik</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://sentientintelligence.com/?p=3</guid>
		<description><![CDATA[As a systems administrator i tend to work on the command line a lot and access servers through the shell a lot. The first thing i usually do in a new role is setting up an SSH key for access to the servers.
Once i have the key set up then i distribute it to the [...]]]></description>
			<content:encoded><![CDATA[<p>As a systems administrator i tend to work on the command line a lot and access servers through the shell a lot. The first thing i usually do in a new role is setting up an SSH key for access to the servers.</p>
<p>Once i have the key set up then i distribute it to the various servers so that i can shell into the servers without having to type in my password everytime i needed to access a server.</p>
<p>The client here is the machine that you normally use to work or access the remote machine from.</p>
<p>The basic steps to follow are</p>
<ul>
<li>Generating a Key</li>
<li>Distributing the Key</li>
<li>Setting up key access limits for more security</li>
</ul>
<p>Its a good idea to verify that SSH is installed before starting &#8211; the following command should tell you what veresion of SSH you&#8217;ve got installed</p>
<blockquote>
<pre>bhowmik@ubuntu:~$ ssh -V
OpenSSH_5.1p1 Debian-5ubuntu1, OpenSSL 0.9.8g 19 Oct 2007</pre>
</blockquote>
<h3>Generating a key</h3>
<p>Generating a key is fairly easy, all you need to do is run the <em>ssh-keygen</em> command. By default it generates a 2048 bit key which is considered fairly secure. You can specify a custom number of bits using the <em>-b &lt;bits&gt;</em> option at the  command line with <em>ssh-keygen</em></p>
<blockquote>
<pre>bhowmik@ubuntu:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/bhowmik/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):</pre>
</blockquote>
<p>Make sure that you do not enter an empty passphrase or your password as a passphrase. The whole point of having a passphrase is to use a <em>phrase </em>for security as opposed to a password. It is even better if you can intersperse your passphrase with uppercase, lowercase, numeric and special characters. Something like &#8220;<strong>$$H is what i use for r3mote Access.</strong>&#8221; is a decent passphrase.</p>
<p>Once you are done with that you will get the following message</p>
<blockquote>
<pre>Your identification has been saved in /home/bhowmik/.ssh/id_rsa.
Your public key has been saved in /home/bhowmik/.ssh/id_rsa.pub.
The key fingerprint is:
43:8c:4b:d4:5c:53:4a:f3:5e:b1:c3:eb:9c:46:ee:44 bhowmik@ubuntu</pre>
</blockquote>
<p>This indicates that your key has been generated. The key is stored in your home directory in the <em>.ssh </em>subdirectory. The <em>id_rsa</em> file is your private key and should not be given out to anybody while the <em>id_rsa.pub </em>is your public which we need to distribute to the servers you want to set up remote access to.</p>
<h3>Distributing the Key</h3>
<p>Once you have generated the key you need to copy it to each server and store it in your home directory on that server in the <em>.ssh</em> folder in the file <em>authorized_keys</em></p>
<p>A simple way to do this would be</p>
<blockquote>
<pre>bhowmik@ubuntu:~$ scp /home/bhowmik/.ssh/id_rsa.pub bhowmik@remote.server:~/.ssh/authorized_keys</pre>
</blockquote>
<p>Where <em>remote.server is </em>the ip address or domain of the remote machine</p>
<p>After copying the file make sure the permissions are sufficiently restrictive on the remote server. The permissions needed are 600 for the <em>authorized_keys</em> file.</p>
<blockquote>
<pre>bhowmik@remote.server:~$ chmod 600 ~/.ssh/authorized_keys</pre>
</blockquote>
<h2>Reference:</h2>
<p><a href="http://manpages.ubuntu.com/manpages/jaunty/en/man1/ssh-keygen.1.html">ssh-keygen man page for Ubuntu 9.04</a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-friendfeed">
			<a href="http://www.friendfeed.com/share?title=SSH+keys+for+remote+access&amp;link=http://sentientintelligence.com/?p=3" rel="nofollow" title="Share this on FriendFeed">Share this on FriendFeed</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=SSH+keys+for+remote+access+-+http://e7t.us/7dfa43+(via+@feeniks)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://sentientintelligence.com/?p=3&feed=comments-rss2" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://sentientintelligence.com/?p=3&amp;title=SSH+keys+for+remote+access" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://sentientintelligence.com/?p=3&amp;title=SSH+keys+for+remote+access" rel="nofollow" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://sentientintelligence.com/?feed=rss2&amp;p=3</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
