<?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>SavvyAdmin.com &#187; SSH</title>
	<atom:link href="http://savvyadmin.com/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://savvyadmin.com</link>
	<description>For savvy admins everywhere...</description>
	<lastBuildDate>Sun, 20 Jun 2010 21:53:13 +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>File Synchronization with Unison over SSH</title>
		<link>http://savvyadmin.com/file-synchronization-with-unison-over-ssh/</link>
		<comments>http://savvyadmin.com/file-synchronization-with-unison-over-ssh/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 01:36:25 +0000</pubDate>
		<dc:creator>gmendoza</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rsync]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Unison]]></category>

		<guid isPermaLink="false">http://www.savvyadmin.com/?p=318</guid>
		<description><![CDATA[Previously, I posted on using rsync over SSH for file synchronization. While this works very well when pushing data in one direction, it&#8217;s not well suited for synchronizing modifications that are made on both sides. An excellent bidirectional utility for that type of job is Unison, which sports many of the same benefits as rsync, [...]


Related posts:<ol><li><a href='http://savvyadmin.com/file-synchronization-with-rsync-over-ssh/' rel='bookmark' title='Permanent Link: File Synchronization with Rsync over SSH'>File Synchronization with Rsync over SSH</a></li>
<li><a href='http://savvyadmin.com/backup-delivery-via-ssh/' rel='bookmark' title='Permanent Link: Backup Delivery via SSH'>Backup Delivery via SSH</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Previously, I <a target="_blank" href="/file-synchronization-with-rsync-over-ssh/">posted</a> on using <em>rsync</em> over SSH for file synchronization.  While this works very well when pushing data in one direction, it&#8217;s not well suited for synchronizing modifications that are made on both sides.  An excellent bidirectional utility for that type of job is <em><a target="_blank" href="http://www.cis.upenn.edu/~bcpierce/unison/index.html">Unison</a></em>, which sports many of the same benefits as rsync, but has some distinct advantages for more complex synchronization scenarios.</p>
<p>A basic example would be to synchronize a local directory called &#8220;<em>MyDocs</em>&#8221; with a remote SSH server.  From the following output, you can see that this directory contains four text files.</p>
<blockquote><p><code><strong>ls -ld ~/MyDocs</strong><br />
drwxr-xr-x 2 gmendoza gmendoza 4096 2009-04-09 16:05 /home/gmendoza/MyDocs</code></p>
<p><code><strong>ls -l ~/MyDocs</strong><br />
total 12<br />
-rw-r--r-- 1 gmendoza gmendoza 31 2009-04-09 16:09 file1.txt<br />
-rw-r--r-- 1 gmendoza gmendoza 31 2009-04-09 16:09 file2.txt<br />
-rw-r--r-- 1 gmendoza gmendoza 31 2009-04-09 16:09 file3.txt<br />
-rw-r--r-- 1 gmendoza gmendoza 31 2009-04-09 16:09 file4.txt</code></p></blockquote>
<p>The first time you run Unison for this particular directory structure, both sides will create a local index and hash table.  You&#8217;ll get a warning and will be prompted with a message, asking you to hit the space bar if you accept.  If the root directory on the remote side does not exist yet, you&#8217;ll also be prompted to accept the changes.</p>
<blockquote><p><code><strong>unison MyDocs ssh://host2/MyDocs</strong><br />
Contacting server...<br />
Connected [//host1//home/gmendoza/MyDocs -> //host2//home/gmendoza/MyDocs]<br />
Looking for changes<br />
Warning: No archive files were found for these roots, whose canonical names are:<br />
	/home/gmendoza/MyDocs<br />
	//host2//home/gmendoza/MyDocs<br />
<em>(snipped for brevity...)</em><br />
Press return to continue.[<strong><spc></strong>]    Waiting for changes from server<br />
Reconciling changes</code></p>
<p><code>local          host2<br />
dir      ---->            /  [<strong>f</strong>] </code></p>
<p><code>Proceed with propagating updates? [] <strong>y</strong><br />
Propagating updates</code></p>
<p><code>UNISON 2.27.57 started propagating changes at 16:14:30 on 09 Apr 2009<br />
[BGN] Copying  from /home/gmendoza/MyDocs to //host2//home/gmendoza/MyDocs<br />
[END] Copying<br />
UNISON 2.27.57 finished propagating changes at 16:14:30 on 09 Apr 2009</code></p>
<p><code>Saving synchronizer state<br />
Synchronization complete  (1 item transferred, 0 skipped, 0 failures)</code></p></blockquote>
<p>Subsequent synchronizations are shown as the following.</p>
<blockquote><p><code><strong>unison MyDocs ssh://host2/MyDocs</strong><br />
Contacting server...<br />
Connected [//host1//home/gmendoza/MyDocs -> //host2//home/gmendoza/MyDocs]<br />
Looking for changes<br />
  Waiting for changes from server<br />
Reconciling changes<br />
Nothing to do: replicas have not changed since last sync.</code></p></blockquote>
<p>For the following example, I have modified file1.txt on host1, and file2.txt on host2.  Both file3.txt and file4.txt have been modified on each side.  The great thing about <em>unison</em> is that when there is a conflict, you have the opportunity to view the differences and select which direction you wish to synchronize.  Pressing the &#8220;x&#8221; key displays some basic information about the files that differ.  In this case, I have chosen the files with the most recent timestamp.  You choose the file direction by pressing the greater and less-than symbols, &#8220;>&#8221; and &#8220;<".</p>
<blockquote><p><code><strong>unison MyDocs ssh://host2/MyDocs</strong><br />
(snipped)<br />
local          host2<br />
changed  <-?-> changed    file3.txt  [] <strong>x</strong><br />
local        : changed file       modified on 2009-04-09 at 16:16:29  size 50<br />
host2  : changed file       modified on <strong>2009-04-09 at 16:16:43</strong>  size 55<br />
changed  <==== changed    file3.txt  [] <strong><</strong><br />
changed  <-?-> changed    file4.txt  [] <strong>x</strong><br />
local        : changed file       modified on <strong>2009-04-09 at 16:17:20</strong>  size 56<br />
host2  : changed file       modified on 2009-04-09 at 16:16:59  size 41<br />
changed  ====> changed    file4.txt  [] <strong>></strong><br />
changed  ---->            file1.txt  [<strong>f</strong>]<br />
         <---- changed    file2.txt  [<strong>f</strong>] </code></p>
<p><code>Proceed with propagating updates? [] <strong>y</strong><br />
Propagating updates</code></p>
<p><code>UNISON 2.27.57 started propagating changes at 16:18:27 on 09 Apr 2009<br />
[BGN] Updating file file3.txt from //host2//home/gmendoza/MyDocs to /home/gmendoza/MyDocs<br />
[BGN] Updating file file4.txt from /home/gmendoza/MyDocs to //host2//home/gmendoza/MyDocs<br />
[BGN] Updating file file1.txt from /home/gmendoza/MyDocs to //host2//home/gmendoza/MyDocs<br />
[BGN] Updating file file2.txt from //host2//home/gmendoza/MyDocs to /home/gmendoza/MyDocs<br />
[END] Updating file file3.txt<br />
[END] Updating file file2.txt<br />
[END] Updating file file4.txt<br />
[END] Updating file file1.txt<br />
UNISON 2.27.57 finished propagating changes at 16:18:27 on 09 Apr 2009</code></p>
<p><code>Saving synchronizer state<br />
Synchronization complete  (4 items transferred, 0 skipped, 0 failures)</code></p></blockquote>
<p>Unison also has a GTK front end for the graphically inclined.  Be sure to check out all the documentation for a full understanding of syntax.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-unison-over-ssh%2F&amp;partner=sociable" title="Print"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-unison-over-ssh%2F&amp;t=File%20Synchronization%20with%20Unison%20over%20SSH" title="Facebook"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://twitter.com/home?status=File%20Synchronization%20with%20Unison%20over%20SSH%20-%20http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-unison-over-ssh%2F" title="Twitter"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-unison-over-ssh%2F&amp;title=File%20Synchronization%20with%20Unison%20over%20SSH&amp;notes=Previously%2C%20I%20posted%20on%20using%20rsync%20over%20SSH%20for%20file%20synchronization.%20%20While%20this%20works%20very%20well%20when%20pushing%20data%20in%20one%20direction%2C%20it%27s%20not%20well%20suited%20for%20synchronizing%20modifications%20that%20are%20made%20on%20both%20sides.%20%20An%20excellent%20bidirectional%20utili" title="del.icio.us"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://savvyadmin.com/feed/" title="RSS"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-unison-over-ssh%2F&amp;title=File%20Synchronization%20with%20Unison%20over%20SSH&amp;bodytext=Previously%2C%20I%20posted%20on%20using%20rsync%20over%20SSH%20for%20file%20synchronization.%20%20While%20this%20works%20very%20well%20when%20pushing%20data%20in%20one%20direction%2C%20it%27s%20not%20well%20suited%20for%20synchronizing%20modifications%20that%20are%20made%20on%20both%20sides.%20%20An%20excellent%20bidirectional%20utili" title="Digg"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="mailto:?subject=File%20Synchronization%20with%20Unison%20over%20SSH&amp;body=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-unison-over-ssh%2F" title="email"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-unison-over-ssh%2F&amp;title=File%20Synchronization%20with%20Unison%20over%20SSH&amp;source=SavvyAdmin.com+For+savvy+admins+everywhere...&amp;summary=Previously%2C%20I%20posted%20on%20using%20rsync%20over%20SSH%20for%20file%20synchronization.%20%20While%20this%20works%20very%20well%20when%20pushing%20data%20in%20one%20direction%2C%20it%27s%20not%20well%20suited%20for%20synchronizing%20modifications%20that%20are%20made%20on%20both%20sides.%20%20An%20excellent%20bidirectional%20utili" title="LinkedIn"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-unison-over-ssh%2F" title="Identi.ca"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-unison-over-ssh%2F&amp;title=File%20Synchronization%20with%20Unison%20over%20SSH&amp;annotation=Previously%2C%20I%20posted%20on%20using%20rsync%20over%20SSH%20for%20file%20synchronization.%20%20While%20this%20works%20very%20well%20when%20pushing%20data%20in%20one%20direction%2C%20it%27s%20not%20well%20suited%20for%20synchronizing%20modifications%20that%20are%20made%20on%20both%20sides.%20%20An%20excellent%20bidirectional%20utili" title="Google Bookmarks"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-unison-over-ssh%2F&amp;title=File%20Synchronization%20with%20Unison%20over%20SSH" title="StumbleUpon"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>


<p>Related posts:<ol><li><a href='http://savvyadmin.com/file-synchronization-with-rsync-over-ssh/' rel='bookmark' title='Permanent Link: File Synchronization with Rsync over SSH'>File Synchronization with Rsync over SSH</a></li>
<li><a href='http://savvyadmin.com/backup-delivery-via-ssh/' rel='bookmark' title='Permanent Link: Backup Delivery via SSH'>Backup Delivery via SSH</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://savvyadmin.com/file-synchronization-with-unison-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>File Synchronization with Rsync over SSH</title>
		<link>http://savvyadmin.com/file-synchronization-with-rsync-over-ssh/</link>
		<comments>http://savvyadmin.com/file-synchronization-with-rsync-over-ssh/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 06:46:07 +0000</pubDate>
		<dc:creator>gmendoza</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rsync]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.savvyadmin.com/?p=308</guid>
		<description><![CDATA[To quickly synchronize files between two systems, rsync is an excellent tool that not only decreases the amount of time it takes to transfer files through a data deduplication algorithm, but can also be used transparently over SSH. The beauty of running rsync over SSH is that it does not require the rsyncd server to [...]


Related posts:<ol><li><a href='http://savvyadmin.com/file-synchronization-with-unison-over-ssh/' rel='bookmark' title='Permanent Link: File Synchronization with Unison over SSH'>File Synchronization with Unison over SSH</a></li>
<li><a href='http://savvyadmin.com/backup-delivery-via-ssh/' rel='bookmark' title='Permanent Link: Backup Delivery via SSH'>Backup Delivery via SSH</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>To quickly synchronize files between two systems, rsync is an excellent tool that not only decreases the amount of time it takes to transfer files through a data deduplication algorithm, but can also be used transparently over SSH.  The beauty of running rsync over SSH is that it does not require the rsyncd server to be running before a synchronization request and the connection is both authenticated and encrypted.  All that is required is for the remote host you are connecting to be running the OpenSSH server component and of course the rsync application.</p>
<p>I use rsync the most for synchronizing my &#8220;<em>Music</em>&#8221; and &#8220;<em>Documents</em>&#8221; folders between a number of my systems at home and at work.  All of these systems have these folders in the root of my home directory.</p>
<blockquote><pre><strong>ls -ld ~/Music ~/Documents</strong>
drwxr-xr-x 16 gmendoza gmendoza 4096 2009-04-06 23:23 /home/gmendoza/Documents
drwxr-xr-x  9 gmendoza gmendoza 4096 2009-04-06 23:23 /home/gmendoza/Music</pre>
</blockquote>
<p>To push my recent changes from my local system (host1) to my remote system called (host2), I use the following commands.</p>
<blockquote><pre><strong>rsync -avPe ssh ~/Music host2:~/
rsync -avPe ssh ~/Documents host2:~/</strong></pre>
</blockquote>
<p>Notice, &#8220;Music&#8221; and &#8220;Documents&#8221; are specified without a trailing &#8220;/&#8221;, e.g. &#8220;Music/&#8221; or &#8220;Documents/&#8221;.  This is important, because otherwise, it would copy only the <em>contents</em> of the folder to the remote home directory, and not the folder itself, which is described in more detail in the rsync man page.</p>
<p>Instead of running the above commands twice, you can also specify multiple files all in a single line.</p>
<blockquote><pre><strong>rsync -avPe ssh ~/Music ~/Documents host2:~/</strong></pre>
</blockquote>
<p>To synchronize changes made on the remote system to my local system, just reverse the commands.  Notice the periods at the end of the line, which specifies the destination as the local working directory.  Also, instead of wasting space by entering the host twice, you can use standard syntax to specify ranges or sets of files.  In this case, I use curly brackets to specify the two directories on the remote host that share the same parent directory should be copied to my local working directory.</p>
<blockquote><pre><strong>rsync -avPe ssh host2:~/{Music,Documents} .</strong></pre>
</blockquote>
<p>I&#8217;ll also use the &#8220;delete&#8221; option to remove any files and folders the have been removed from the source system.</p>
<blockquote><pre><strong>rsync --delete -avPe ssh ~/Music host2:~/</strong></pre>
</blockquote>
<p>By default, rsync compares files extremely fast using a &#8220;quick check&#8221; algorithm based on the file size or in the last modified time (per the rsync man page).  While I was updating my Music collection, I noticed that rsync was not detecting my ID3 tag modifications.  By using the &#8220;-c&#8221; option, rsync will compare files using a 128 bit MD4 checksum as a more definitive change detection method.  While this will slow the process down significantly, there&#8217;s obvious accuracy benefits in using the checksum method.</p>
<blockquote><pre><strong>rsync -acvPe ssh Music host2:~/</strong></pre>
</blockquote>
<p>Also, as you may have noticed rsync is strictly a unidirectional utility.  This means that it only sends or receives data in a<em> single direction</em>, and it will clobber or delete any file or folder with the same name in the direction your are sending the data.  For a great bidirectional utility, check out <em>unison</em>, which I will cover in an upcoming article.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-rsync-over-ssh%2F&amp;partner=sociable" title="Print"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-rsync-over-ssh%2F&amp;t=File%20Synchronization%20with%20Rsync%20over%20SSH" title="Facebook"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://twitter.com/home?status=File%20Synchronization%20with%20Rsync%20over%20SSH%20-%20http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-rsync-over-ssh%2F" title="Twitter"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-rsync-over-ssh%2F&amp;title=File%20Synchronization%20with%20Rsync%20over%20SSH&amp;notes=To%20quickly%20synchronize%20files%20between%20two%20systems%2C%20rsync%20is%20an%20excellent%20tool%20that%20not%20only%20decreases%20the%20amount%20of%20time%20it%20takes%20to%20transfer%20files%20through%20a%20data%20deduplication%20algorithm%2C%20but%20can%20also%20be%20used%20transparently%20over%20SSH.%20%20The%20beauty%20of%20run" title="del.icio.us"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://savvyadmin.com/feed/" title="RSS"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-rsync-over-ssh%2F&amp;title=File%20Synchronization%20with%20Rsync%20over%20SSH&amp;bodytext=To%20quickly%20synchronize%20files%20between%20two%20systems%2C%20rsync%20is%20an%20excellent%20tool%20that%20not%20only%20decreases%20the%20amount%20of%20time%20it%20takes%20to%20transfer%20files%20through%20a%20data%20deduplication%20algorithm%2C%20but%20can%20also%20be%20used%20transparently%20over%20SSH.%20%20The%20beauty%20of%20run" title="Digg"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="mailto:?subject=File%20Synchronization%20with%20Rsync%20over%20SSH&amp;body=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-rsync-over-ssh%2F" title="email"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-rsync-over-ssh%2F&amp;title=File%20Synchronization%20with%20Rsync%20over%20SSH&amp;source=SavvyAdmin.com+For+savvy+admins+everywhere...&amp;summary=To%20quickly%20synchronize%20files%20between%20two%20systems%2C%20rsync%20is%20an%20excellent%20tool%20that%20not%20only%20decreases%20the%20amount%20of%20time%20it%20takes%20to%20transfer%20files%20through%20a%20data%20deduplication%20algorithm%2C%20but%20can%20also%20be%20used%20transparently%20over%20SSH.%20%20The%20beauty%20of%20run" title="LinkedIn"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-rsync-over-ssh%2F" title="Identi.ca"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-rsync-over-ssh%2F&amp;title=File%20Synchronization%20with%20Rsync%20over%20SSH&amp;annotation=To%20quickly%20synchronize%20files%20between%20two%20systems%2C%20rsync%20is%20an%20excellent%20tool%20that%20not%20only%20decreases%20the%20amount%20of%20time%20it%20takes%20to%20transfer%20files%20through%20a%20data%20deduplication%20algorithm%2C%20but%20can%20also%20be%20used%20transparently%20over%20SSH.%20%20The%20beauty%20of%20run" title="Google Bookmarks"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fsavvyadmin.com%2Ffile-synchronization-with-rsync-over-ssh%2F&amp;title=File%20Synchronization%20with%20Rsync%20over%20SSH" title="StumbleUpon"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>


<p>Related posts:<ol><li><a href='http://savvyadmin.com/file-synchronization-with-unison-over-ssh/' rel='bookmark' title='Permanent Link: File Synchronization with Unison over SSH'>File Synchronization with Unison over SSH</a></li>
<li><a href='http://savvyadmin.com/backup-delivery-via-ssh/' rel='bookmark' title='Permanent Link: Backup Delivery via SSH'>Backup Delivery via SSH</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://savvyadmin.com/file-synchronization-with-rsync-over-ssh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DenyHosts: Automated SSH Brute Force Response System</title>
		<link>http://savvyadmin.com/denyhosts-automated-ssh-brute-force-response-system/</link>
		<comments>http://savvyadmin.com/denyhosts-automated-ssh-brute-force-response-system/#comments</comments>
		<pubDate>Sun, 02 Sep 2007 20:20:09 +0000</pubDate>
		<dc:creator>gmendoza</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[DenyHosts]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.savvyadmin.com/2007/09/02/denyhosts-automated-ssh-brute-force-response-system/</guid>
		<description><![CDATA[DenyHosts is a project that adds a protective layer to an SSH server by automatically blocking malicious hosts that use brute force or dictionary attacks. If you have SSH services enabled and accessible from the internet, you will likely have thousands of failed login attempts from several sources within a very short period of time. [...]


Related posts:<ol><li><a href='http://savvyadmin.com/fwknop-single-packet-authorization-in-ubuntu/' rel='bookmark' title='Permanent Link: fwknop: Single Packet Authorization in Ubuntu'>fwknop: Single Packet Authorization in Ubuntu</a></li>
<li><a href='http://savvyadmin.com/virtualbox-wireless-bridging-with-dhcp/' rel='bookmark' title='Permanent Link: VirtualBox Wireless Bridging with DHCP'>VirtualBox Wireless Bridging with DHCP</a></li>
<li><a href='http://savvyadmin.com/vlan-hopping-on-cisco-voice-enabled-switch-ports/' rel='bookmark' title='Permanent Link: VLAN Hopping on Cisco Voice-enabled Switch Ports'>VLAN Hopping on Cisco Voice-enabled Switch Ports</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" src="https://www.savvyadmin.com/wp-content/uploads/2007/09/denyhosts.png" alt="DenyHosts" width="260" height="54" /></p>
<p>DenyHosts is a project that adds a protective layer to an SSH server by automatically blocking malicious hosts that use brute force or dictionary attacks.  If you have SSH services enabled and accessible from the internet, you will likely have thousands of failed login attempts from several sources within a very short period of time.  DenyHosts monitors all login attempts, and based on a customizable rule-set can block hosts from making further connections if an attack pattern is matched.</p>
<p>Using tcp_wrappers, the DenyHosts service elegantly manages entries in the /etc/hosts.deny file, adding and removing hosts when thresholds are crossed.  e.g. Three failed logins with unknown user accounts; Three failed logins with root account; Five failed logins with known user accounts; Unblock host after a set period of time; etc.  You can also specify whether DenyHosts blocks access to SSH or ALL services, thereby mitigating any other attack vectors the offender might try next.</p>
<p>A most valuable feature that makes DenyHosts even more attractive is the optional centralized reporting system.  The service can be configured to report all abusive hosts to the DenyHosts collection server, and automatically import a list of IP addresses that others have reported.  This network of intelligence gathering and incident response helps to thwart a large number of attacks before they happen, because the attackers (most of which are automated bots) are blocked before they have a chance to move on to other protected servers.Other useful features include email notification when hosts are blocked, and counter resets after successful authentication to prevent accidental blacklisting caused by fat fingered admins.  :-)</p>
<p>For those of you using Ubuntu 7.04 (Feisty Fawn) and above, it is available in the Universe repository:</p>
<blockquote><p><code><strong>sudo  apt-get install denyhosts</strong></code></p></blockquote>
<p>Edit and customize /etc/denyhosts.conf for your desired options, and restart the service:</p>
<blockquote><p><code><strong>sudo /etc/init.d/denyhosts restart</strong></code></p></blockquote>
<p>Ubuntu 6.06.1 LTS will need a manual installation, as it is not included in the repositories.</p>
<p>Be sure to check out the project at <a title="DenyHosts Project Website" href="http://denyhosts.sourceforge.net" target="_blank">http://denyhosts.sourceforge.net</a>.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fsavvyadmin.com%2Fdenyhosts-automated-ssh-brute-force-response-system%2F&amp;partner=sociable" title="Print"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fsavvyadmin.com%2Fdenyhosts-automated-ssh-brute-force-response-system%2F&amp;t=DenyHosts%3A%20Automated%20SSH%20Brute%20Force%20Response%20System" title="Facebook"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://twitter.com/home?status=DenyHosts%3A%20Automated%20SSH%20Brute%20Force%20Response%20System%20-%20http%3A%2F%2Fsavvyadmin.com%2Fdenyhosts-automated-ssh-brute-force-response-system%2F" title="Twitter"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fsavvyadmin.com%2Fdenyhosts-automated-ssh-brute-force-response-system%2F&amp;title=DenyHosts%3A%20Automated%20SSH%20Brute%20Force%20Response%20System&amp;notes=%0D%0A%0D%0ADenyHosts%20is%20a%20project%20that%20adds%20a%20protective%20layer%20to%20an%20SSH%20server%20by%20automatically%20blocking%20malicious%20hosts%20that%20use%20brute%20force%20or%20dictionary%20attacks.%20%20If%20you%20have%20SSH%20services%20enabled%20and%20accessible%20from%20the%20internet%2C%20you%20will%20likely%20have%20th" title="del.icio.us"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://savvyadmin.com/feed/" title="RSS"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsavvyadmin.com%2Fdenyhosts-automated-ssh-brute-force-response-system%2F&amp;title=DenyHosts%3A%20Automated%20SSH%20Brute%20Force%20Response%20System&amp;bodytext=%0D%0A%0D%0ADenyHosts%20is%20a%20project%20that%20adds%20a%20protective%20layer%20to%20an%20SSH%20server%20by%20automatically%20blocking%20malicious%20hosts%20that%20use%20brute%20force%20or%20dictionary%20attacks.%20%20If%20you%20have%20SSH%20services%20enabled%20and%20accessible%20from%20the%20internet%2C%20you%20will%20likely%20have%20th" title="Digg"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="mailto:?subject=DenyHosts%3A%20Automated%20SSH%20Brute%20Force%20Response%20System&amp;body=http%3A%2F%2Fsavvyadmin.com%2Fdenyhosts-automated-ssh-brute-force-response-system%2F" title="email"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fsavvyadmin.com%2Fdenyhosts-automated-ssh-brute-force-response-system%2F&amp;title=DenyHosts%3A%20Automated%20SSH%20Brute%20Force%20Response%20System&amp;source=SavvyAdmin.com+For+savvy+admins+everywhere...&amp;summary=%0D%0A%0D%0ADenyHosts%20is%20a%20project%20that%20adds%20a%20protective%20layer%20to%20an%20SSH%20server%20by%20automatically%20blocking%20malicious%20hosts%20that%20use%20brute%20force%20or%20dictionary%20attacks.%20%20If%20you%20have%20SSH%20services%20enabled%20and%20accessible%20from%20the%20internet%2C%20you%20will%20likely%20have%20th" title="LinkedIn"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fsavvyadmin.com%2Fdenyhosts-automated-ssh-brute-force-response-system%2F" title="Identi.ca"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fsavvyadmin.com%2Fdenyhosts-automated-ssh-brute-force-response-system%2F&amp;title=DenyHosts%3A%20Automated%20SSH%20Brute%20Force%20Response%20System&amp;annotation=%0D%0A%0D%0ADenyHosts%20is%20a%20project%20that%20adds%20a%20protective%20layer%20to%20an%20SSH%20server%20by%20automatically%20blocking%20malicious%20hosts%20that%20use%20brute%20force%20or%20dictionary%20attacks.%20%20If%20you%20have%20SSH%20services%20enabled%20and%20accessible%20from%20the%20internet%2C%20you%20will%20likely%20have%20th" title="Google Bookmarks"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fsavvyadmin.com%2Fdenyhosts-automated-ssh-brute-force-response-system%2F&amp;title=DenyHosts%3A%20Automated%20SSH%20Brute%20Force%20Response%20System" title="StumbleUpon"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>


<p>Related posts:<ol><li><a href='http://savvyadmin.com/fwknop-single-packet-authorization-in-ubuntu/' rel='bookmark' title='Permanent Link: fwknop: Single Packet Authorization in Ubuntu'>fwknop: Single Packet Authorization in Ubuntu</a></li>
<li><a href='http://savvyadmin.com/virtualbox-wireless-bridging-with-dhcp/' rel='bookmark' title='Permanent Link: VirtualBox Wireless Bridging with DHCP'>VirtualBox Wireless Bridging with DHCP</a></li>
<li><a href='http://savvyadmin.com/vlan-hopping-on-cisco-voice-enabled-switch-ports/' rel='bookmark' title='Permanent Link: VLAN Hopping on Cisco Voice-enabled Switch Ports'>VLAN Hopping on Cisco Voice-enabled Switch Ports</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://savvyadmin.com/denyhosts-automated-ssh-brute-force-response-system/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Secure Internet Access via SSH Proxy</title>
		<link>http://savvyadmin.com/secure-internet-access-via-ssh-proxy/</link>
		<comments>http://savvyadmin.com/secure-internet-access-via-ssh-proxy/#comments</comments>
		<pubDate>Sat, 23 Jun 2007 00:41:26 +0000</pubDate>
		<dc:creator>gmendoza</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.savvyadmin.com/2007/06/22/secure-internet-access-via-ssh-proxy/</guid>
		<description><![CDATA[An OpenSSH server can be used as a SOCKS compliant proxy, allowing one to tunnel virtually any type of traffic via the SSH protocol. This is very useful when surfing the web on untrusted networks such as hotel internet services and wireless hotspots. You just never know who&#8217;s snooping in on your data. All you [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>An OpenSSH server can be used as a SOCKS compliant proxy, allowing one to tunnel virtually any type of traffic via the SSH protocol.  This is very useful when surfing the web on untrusted networks such as hotel internet services and wireless hotspots.  You just never know who&#8217;s snooping in on your data.</p>
<p>All you need is external access to a trusted OpenSSH server, perhaps the one you have at home, work, etc.  If you&#8217;re using your laptop to surf the internet at your local coffee shop, you&#8217;ll simply need to establish a connection to that external SSH server using the appropriate client variables, and configure your web browser&#8217;s proxy settings to connect to a locally defined TCP port.<span id="more-16"></span></p>
<p>From a Linux terminal session on your local computer, run the following command:</p>
<blockquote><p><code>$ ssh -ND 8080 user@server.yourdomain.com</code></p></blockquote>
<p>You will be prompted for a password as you would normally expect when connecting to your server.  After you make a successful connection, the session does not execute your default shell, and the command will remain silent until you close the console or terminate the process.</p>
<p>The &#8220;-D 8080&#8243; option opens TCP port 8080 on your local client, which you will use as the SOCKS proxy port to tunnel your connections through.  This can be verified via netstat:</p>
<blockquote><p><code>$ netstat -an | grep 8080<br />
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN</code></p></blockquote>
<p>Next, you change your browser (or any other application) proxy settings to connect to your localhost (127.0.0.1) port 8080.  For example, here is a screenshot of the appropriate Firefox settings.</p>
<p style="text-align: center;"><img class="aligncenter" src="https://www.savvyadmin.com/wp-content/uploads/2007/06/firefox-connection-settings.png" alt="Firefox Connection Settings" /></p>
<p>You should also make sure that your web browser is using the proxy for DNS queries.  This is important because even if people cannot &#8220;see&#8221; the content of your browser traffic, they would still be able to get a feel for what your are doing by your DNS lookups.  There is also a risk of a malicious user feeding you dangerous DNS answers which could send you in the wrong direction leaving you open to man in the middle attacks.</p>
<p>In firefox, open &#8220;about:config&#8221; in your location bar, and change the value of &#8220;network.proxy.socks_remote_dns&#8221; to &#8220;true&#8221;.</p>
<p style="text-align: center;"><img class="aligncenter" src="https://www.savvyadmin.com/wp-content/uploads/2007/06/firefox-proxy-dns.png" alt="Firefox Proxy DNS" /></p>
<p>You are now ready to surf securely.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fsavvyadmin.com%2Fsecure-internet-access-via-ssh-proxy%2F&amp;partner=sociable" title="Print"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fsavvyadmin.com%2Fsecure-internet-access-via-ssh-proxy%2F&amp;t=Secure%20Internet%20Access%20via%20SSH%20Proxy" title="Facebook"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://twitter.com/home?status=Secure%20Internet%20Access%20via%20SSH%20Proxy%20-%20http%3A%2F%2Fsavvyadmin.com%2Fsecure-internet-access-via-ssh-proxy%2F" title="Twitter"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fsavvyadmin.com%2Fsecure-internet-access-via-ssh-proxy%2F&amp;title=Secure%20Internet%20Access%20via%20SSH%20Proxy&amp;notes=An%20OpenSSH%20server%20can%20be%20used%20as%20a%20SOCKS%20compliant%20proxy%2C%20allowing%20one%20to%20tunnel%20virtually%20any%20type%20of%20traffic%20via%20the%20SSH%20protocol.%20%20This%20is%20very%20useful%20when%20surfing%20the%20web%20on%20untrusted%20networks%20such%20as%20hotel%20internet%20services%20and%20wireless%20hotspots" title="del.icio.us"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://savvyadmin.com/feed/" title="RSS"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsavvyadmin.com%2Fsecure-internet-access-via-ssh-proxy%2F&amp;title=Secure%20Internet%20Access%20via%20SSH%20Proxy&amp;bodytext=An%20OpenSSH%20server%20can%20be%20used%20as%20a%20SOCKS%20compliant%20proxy%2C%20allowing%20one%20to%20tunnel%20virtually%20any%20type%20of%20traffic%20via%20the%20SSH%20protocol.%20%20This%20is%20very%20useful%20when%20surfing%20the%20web%20on%20untrusted%20networks%20such%20as%20hotel%20internet%20services%20and%20wireless%20hotspots" title="Digg"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="mailto:?subject=Secure%20Internet%20Access%20via%20SSH%20Proxy&amp;body=http%3A%2F%2Fsavvyadmin.com%2Fsecure-internet-access-via-ssh-proxy%2F" title="email"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fsavvyadmin.com%2Fsecure-internet-access-via-ssh-proxy%2F&amp;title=Secure%20Internet%20Access%20via%20SSH%20Proxy&amp;source=SavvyAdmin.com+For+savvy+admins+everywhere...&amp;summary=An%20OpenSSH%20server%20can%20be%20used%20as%20a%20SOCKS%20compliant%20proxy%2C%20allowing%20one%20to%20tunnel%20virtually%20any%20type%20of%20traffic%20via%20the%20SSH%20protocol.%20%20This%20is%20very%20useful%20when%20surfing%20the%20web%20on%20untrusted%20networks%20such%20as%20hotel%20internet%20services%20and%20wireless%20hotspots" title="LinkedIn"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fsavvyadmin.com%2Fsecure-internet-access-via-ssh-proxy%2F" title="Identi.ca"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fsavvyadmin.com%2Fsecure-internet-access-via-ssh-proxy%2F&amp;title=Secure%20Internet%20Access%20via%20SSH%20Proxy&amp;annotation=An%20OpenSSH%20server%20can%20be%20used%20as%20a%20SOCKS%20compliant%20proxy%2C%20allowing%20one%20to%20tunnel%20virtually%20any%20type%20of%20traffic%20via%20the%20SSH%20protocol.%20%20This%20is%20very%20useful%20when%20surfing%20the%20web%20on%20untrusted%20networks%20such%20as%20hotel%20internet%20services%20and%20wireless%20hotspots" title="Google Bookmarks"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fsavvyadmin.com%2Fsecure-internet-access-via-ssh-proxy%2F&amp;title=Secure%20Internet%20Access%20via%20SSH%20Proxy" title="StumbleUpon"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://savvyadmin.com/secure-internet-access-via-ssh-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup Delivery via SSH</title>
		<link>http://savvyadmin.com/backup-delivery-via-ssh/</link>
		<comments>http://savvyadmin.com/backup-delivery-via-ssh/#comments</comments>
		<pubDate>Tue, 05 Jun 2007 07:12:41 +0000</pubDate>
		<dc:creator>gmendoza</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.savvyadmin.com/2007/06/05/backup-delivery-via-ssh/</guid>
		<description><![CDATA[If you&#8217;re not going to use tapes, CD&#8217;s, DVD&#8217;s, or other form of attached media for storing your backups, you&#8217;re more than likely going to use some form of a remote network storage repository. There are many ways to ship your *nix backups across a network to a remote file system. Using SSH (and its [...]


Related posts:<ol><li><a href='http://savvyadmin.com/file-synchronization-with-rsync-over-ssh/' rel='bookmark' title='Permanent Link: File Synchronization with Rsync over SSH'>File Synchronization with Rsync over SSH</a></li>
<li><a href='http://savvyadmin.com/file-synchronization-with-unison-over-ssh/' rel='bookmark' title='Permanent Link: File Synchronization with Unison over SSH'>File Synchronization with Unison over SSH</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re not going to use tapes, CD&#8217;s, DVD&#8217;s, or other form of attached media for storing your backups, you&#8217;re more than likely going to use some form of a remote network storage repository. There are many ways to ship your *nix backups across a network to a remote file system. Using SSH (and its related tools) is among the most popular methods for this delivery process as it can be relatively fast, free, secure, and very flexible.</p>
<p>In the following examples, I&#8217;ll show you three ways to ship an archived folder to a remote SSH server.</p>
<p><strong>Method 1: Secure Copy</strong><br />
Using &#8216;scp&#8217;, (secure copy), one can take any existing file and deliver it to an SSH server. This means that you can create a backup, store it temporarily to your &#8220;local&#8221; file system, and copy the file across the network.</p>
<p>In this example, one backs up a folder in their home directory called &#8220;myfiles&#8221; using tar and gzip compression, and then copies the resulting archive using scp to a folder called /archives on a remote SSH server.</p>
<blockquote><p><code>$ tar -czvpf myfiles.tar.gz ~/myfiles<br />
$ scp myfiles.tar.gz user@sshserver:/archives/<br />
$ rm myfiles.tar.gz</code></p></blockquote>
<p>Cool stuff, but the downside is two-fold:<br />
(1) If your backup is larger than the available space on your local file system, this method obviously won&#8217;t work;<br />
(2) If your backup is large, the entire process takes a little longer than you might find convenient, since you have to first create the backup, and then copy it across the network.</p>
<p>A better solution would be to start sending the backup during the file creation process, which leads us to to the next two methods.</p>
<p><strong>Method 2: Concatenate to SSH</strong><br />
SSH can read from STDIN and print results to STDOUT, which means one can concatenate any type of &#8220;input&#8221; to a remote SSH server. For example, you could redirect the output of &#8216;tar&#8217; using the following syntax:</p>
<blockquote><p><code>$ tar czpvf - ~/myfiles | ssh user@sshserver "cat &gt; /archives/myfiles.tar.gz"</code></p></blockquote>
<p>As you can see, with a single command, you can both create and deliver the backup at the same time. The backup process does not take up any space on the local file system.  Wicked cool!</p>
<p>There is however yet another way to accomplish this task as shown in the next section.</p>
<p><strong>Method 3: Write to an SSH File System (SSHFS)</strong><br />
For those of you not familiar with <a href="http://fuse.sourceforge.net/sshfs.html">SSHFS</a>, this is a file system client based on SFTP and FUSE. This client allows you to mount any remote SSH server to a local empty directory, just as you would with other devices like CD/ROM&#8217;s, floppies, usb sticks, etc. What&#8217;s also great about this client is that it requires no server side modification. It&#8217;s resource friendly, and sending data is just as fast as any other SSH file transfer.</p>
<p>In Ubuntu 7.04, the fuse kernel module and utilities are installed by default, and sshfs is available in the repositories.</p>
<p>Once you have sshfs installed and working, the following example mounts the remote &#8220;/archives&#8221; directory to the local &#8220;~/temp-mount&#8221; folder, and then places the backup directly in the mounted file system. The file is transported across the network during the write process.</p>
<blockquote><p><code>$ mkdir ~/temp-mount<br />
$ sshfs  user@sshserver:/archives ~/temp-mount<br />
$ tar -czvpf ~/temp-mount/myfiles.tar.gz ~/myfiles</code></p></blockquote>
<p>To unmount the directory,</p>
<blockquote><p><code>$ fusermount -u ~/mnt</code></p></blockquote>
<p><strong>Conclusion:</strong><br />
As you can see, using SSH for the delivery of your backups can make your life a whole lot easier. A suggested practice would be to use DSA/RSA public key authentication for making SSH connections. This way, you don&#8217;t have rely on passwords every time the SSH client is used, which makes sense when applying any of the above examples to an automated process such as Crontab, or At.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fsavvyadmin.com%2Fbackup-delivery-via-ssh%2F&amp;partner=sociable" title="Print"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fsavvyadmin.com%2Fbackup-delivery-via-ssh%2F&amp;t=Backup%20Delivery%20via%20SSH" title="Facebook"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://twitter.com/home?status=Backup%20Delivery%20via%20SSH%20-%20http%3A%2F%2Fsavvyadmin.com%2Fbackup-delivery-via-ssh%2F" title="Twitter"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fsavvyadmin.com%2Fbackup-delivery-via-ssh%2F&amp;title=Backup%20Delivery%20via%20SSH&amp;notes=If%20you%27re%20not%20going%20to%20use%20tapes%2C%20CD%27s%2C%20DVD%27s%2C%20or%20other%20form%20of%20attached%20media%20for%20storing%20your%20backups%2C%20you%27re%20more%20than%20likely%20going%20to%20use%20some%20form%20of%20a%20remote%20network%20storage%20repository.%20There%20are%20many%20ways%20to%20ship%20your%20%2Anix%20backups%20across%20a%20net" title="del.icio.us"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://savvyadmin.com/feed/" title="RSS"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsavvyadmin.com%2Fbackup-delivery-via-ssh%2F&amp;title=Backup%20Delivery%20via%20SSH&amp;bodytext=If%20you%27re%20not%20going%20to%20use%20tapes%2C%20CD%27s%2C%20DVD%27s%2C%20or%20other%20form%20of%20attached%20media%20for%20storing%20your%20backups%2C%20you%27re%20more%20than%20likely%20going%20to%20use%20some%20form%20of%20a%20remote%20network%20storage%20repository.%20There%20are%20many%20ways%20to%20ship%20your%20%2Anix%20backups%20across%20a%20net" title="Digg"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="mailto:?subject=Backup%20Delivery%20via%20SSH&amp;body=http%3A%2F%2Fsavvyadmin.com%2Fbackup-delivery-via-ssh%2F" title="email"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fsavvyadmin.com%2Fbackup-delivery-via-ssh%2F&amp;title=Backup%20Delivery%20via%20SSH&amp;source=SavvyAdmin.com+For+savvy+admins+everywhere...&amp;summary=If%20you%27re%20not%20going%20to%20use%20tapes%2C%20CD%27s%2C%20DVD%27s%2C%20or%20other%20form%20of%20attached%20media%20for%20storing%20your%20backups%2C%20you%27re%20more%20than%20likely%20going%20to%20use%20some%20form%20of%20a%20remote%20network%20storage%20repository.%20There%20are%20many%20ways%20to%20ship%20your%20%2Anix%20backups%20across%20a%20net" title="LinkedIn"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fsavvyadmin.com%2Fbackup-delivery-via-ssh%2F" title="Identi.ca"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fsavvyadmin.com%2Fbackup-delivery-via-ssh%2F&amp;title=Backup%20Delivery%20via%20SSH&amp;annotation=If%20you%27re%20not%20going%20to%20use%20tapes%2C%20CD%27s%2C%20DVD%27s%2C%20or%20other%20form%20of%20attached%20media%20for%20storing%20your%20backups%2C%20you%27re%20more%20than%20likely%20going%20to%20use%20some%20form%20of%20a%20remote%20network%20storage%20repository.%20There%20are%20many%20ways%20to%20ship%20your%20%2Anix%20backups%20across%20a%20net" title="Google Bookmarks"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fsavvyadmin.com%2Fbackup-delivery-via-ssh%2F&amp;title=Backup%20Delivery%20via%20SSH" title="StumbleUpon"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>


<p>Related posts:<ol><li><a href='http://savvyadmin.com/file-synchronization-with-rsync-over-ssh/' rel='bookmark' title='Permanent Link: File Synchronization with Rsync over SSH'>File Synchronization with Rsync over SSH</a></li>
<li><a href='http://savvyadmin.com/file-synchronization-with-unison-over-ssh/' rel='bookmark' title='Permanent Link: File Synchronization with Unison over SSH'>File Synchronization with Unison over SSH</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://savvyadmin.com/backup-delivery-via-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
