<?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>eRacks Open Source Systems Blog &#187; ssh</title>
	<atom:link href="http://blog.eracks.com/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.eracks.com</link>
	<description>Making the world safe for Open Source</description>
	<lastBuildDate>Wed, 10 Aug 2011 23:35:49 +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>Putting SSH Keys to Work</title>
		<link>http://blog.eracks.com/2008/11/putting-ssh-keys-to-work/</link>
		<comments>http://blog.eracks.com/2008/11/putting-ssh-keys-to-work/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 00:13:30 +0000</pubDate>
		<dc:creator>james</dc:creator>
				<category><![CDATA[authentication]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[public]]></category>
		<category><![CDATA[ssh-keygen]]></category>

		<guid isPermaLink="false">http://blog.eracks.com/?p=70</guid>
		<description><![CDATA[There may be situations where you&#8217;d like to login to a remote machine via SSH and not have to enter a password to do it. Perhaps you have some sort of automated file transfer that makes use of SCP. Or, perhaps you frequently login to the same machine and get tired of having to enter [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-bottom: 0in;">There may be situations where you&#8217;d like to login to a remote machine via SSH  and not have to enter a password to do it.  Perhaps you have some sort of  automated file transfer that makes use of SCP.  Or, perhaps you frequently login  to the same machine and get tired of having to enter a password each time.  Whatever the reason may be, an attractive alternative to using passwords  involves making use of cryptographic keys.</p>
<p style="margin-bottom: 0in;">To give you a general idea of what&#8217;s involved, you&#8217;ll first generate a  public/private key pair.  Your public key is what you would copy to every  machine you want to be able to log into.  You can think of the public key as the  lock on a door to a house.  The reason why we call this a public key is that it&#8217;s safe to share it with the public, just as the lock on your door is safe to  display from the outside.  By contrast, your private key can be thought of as  the key that fits into the lock.  Unlike your public key, you should never copy  it to machines that are either untrusted or to machines that you yourself don&#8217;t administer &#8212; this would be a bit like placing the key to your front door  outside your house for strangers to use!  Anybody who possesses your private key  can access every machine to which you&#8217;ve made your public key accessible, so  exercise extreme caution and guard your private key with your life.</p>
<p style="margin-bottom: 0in;">SSH makes generating your keys very simple.  From the command line, you&#8217;ll  simply enter the following command:</p>
<p style="margin-bottom: 0in;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">$ssh-keygen </span></span></p>
<p style="margin-bottom: 0in;">You&#8217;ll then be asked a series of questions.  Accept all the defaults.  If you  don&#8217;t desire to password protect your key pair (which would require you to  enter a password when you use it), hit enter when asked for the password, without typing anything in.  At the end of the process, you should discover two  new files in <span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">~/.ssh</span></span><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">, </span></span><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">id_rsa</span></span> and<span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> id_rsa.pub</span></span>, where ~ stands for your home  directory.  From here, you&#8217;ll copy your public key (<span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">id_rsa.pub</span></span>) to every machine  you wish to log into and append its contents to a file called  <span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">~/.ssh/authorized_keys</span></span>, where ~ stands for the home directory of the account  you wish to log into.</p>
<p style="margin-bottom: 0in;">To test your newly generated key pair, try to connect to one or more of the  remote machines you copied your public key to.  You&#8217;ll find that you&#8217;re sent  straight to a command prompt, without the need for a password.</p>
<p style="margin-bottom: 0in;">Now, there are situations where using keys without passwords can potentially be hazardous, so some significant thought should be given to the circumstances in which your key pair will be used.  For example, I will never copy my laptop&#8217;s public key to my personal server at home, because if my laptop is ever stolen, the thief (if he knew how to use *NIX) would not only have access to all my local data, but would also have complete SSH access to my network at home, since he would have my laptop&#8217;s private key.  Thus, I choose to sacrifice convenience for security in that particular situation.  As with all things in life, the amount of relative security versus convenience is a trade off, so make sure you choose wisely.</p>
<p style="margin-bottom: 0in;">Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eracks.com/2008/11/putting-ssh-keys-to-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful commands for backing up filesystems</title>
		<link>http://blog.eracks.com/2008/05/useful-commands-for-backing-up-filesystems/</link>
		<comments>http://blog.eracks.com/2008/05/useful-commands-for-backing-up-filesystems/#comments</comments>
		<pubDate>Wed, 28 May 2008 22:09:14 +0000</pubDate>
		<dc:creator>james</dc:creator>
				<category><![CDATA[Backups]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bzip]]></category>
		<category><![CDATA[bzip2]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[partition]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://blog.eracks.com/?p=9</guid>
		<description><![CDATA[Have you ever needed to backup the contents of one or more filesystems to another machine, yet you only had a single hard drive in the machine being backed up and found that you lacked the temporary disk space necessary to create your backup before shuttling it across the network to its final destination? As [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever needed to backup the contents of one or more filesystems to another machine, yet you only had a single hard drive in the machine being backed up and found that you lacked the temporary disk space necessary to create your backup before shuttling it across the network to its final destination?</p>
<p>As an example, when I backup my laptop, I have too many gigabytes of data to realistically store my data on DVD-R&#8217;s, and my only option is to create a tarball of the root filesystem and store it on another machine on my network.  The problem is that if I try to create a backup of my laptop&#8217;s contents, I find that the resulting tarball backup is too large to fit on the hard drive along with all the data.</p>
<p>One solution that I&#8217;ve found to this problem is to avoid storing the backup on the source machine altogether.  Through stdin and stdout, along with the magic of *NIX pipes, we can stream the data in realtime over to its destination, and only then write it to disk.</p>
<p>Before we begin, it is very important to note that in most situations, you&#8217;ll have to boot into another environment and manually mount your partition before proceeding, particularly when dealing with an operating system&#8217;s root filesystem.  Otherwise, not only will tar choke on certain directories like /proc and /dev, the contents of the disk will also continue to change as the backup is being made, leading to inconsistencies between the data on your filesystem and the data in the backup.</p>
<p>With that in mind, assuming that you have ssh installed and configured correctly on both the source and destination computers, you can create a backup with the following commands (as root):</p>
<p>#cd /path/to/your/mounted/filesystem<br />
#tar -jcvp | ssh username@destination &#8220;cat &gt; /path/to/backup.tar.bz2&#8243;</p>
<p>If you prefer to use gzip as opposed to bzip2, replace the above tar command with the following:</p>
<p>#tar -zcvp | ssh username@destination &#8220;cat &gt; /path/to/backup.tar.gz&#8221;</p>
<p>Now, let&#8217;s say that you&#8217;ve created a new partition and want to restore a previous backup.  Again, assuming that ssh is configured properly on the source and the destination machines, and assuming that you&#8217;ve mounted your partition, you would recover your backup with the following commands (again, as root):</p>
<p>#cd /path/to/your/mounted/filesystem<br />
#ssh username@destination &#8220;cat /path/to/backup.tar.bz2&#8243; | tar -jvxp</p>
<p>If the backup is a gzipped archive, then replace the above tar command with the following:</p>
<p>#ssh username@destination &#8220;cat /path/to/backup.tar.gz&#8221; | tar -zvxp</p>
<p>Note that the user specified by &#8216;username&#8217; above should have read/write permissions on the directory where the backup is to be stored for this procedure to work.</p>
<p>The astute reader will probably notice the missing -f option, which one usually passes to tar.  The reason for this is that it tells tar to write its data to, or read its data from, a file.  However, by ommitting it, we tell tar to send its output to stdout, or to receive its data from stdin when reading from an archive, which allows us to make use of pipes.  It&#8217;s situations like these where the power of *NIX really shines!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eracks.com/2008/05/useful-commands-for-backing-up-filesystems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

