<?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>Make Tech Easier &#187; openssh</title>
	<atom:link href="http://maketecheasier.com/tag/openssh/feed" rel="self" type="application/rss+xml" />
	<link>http://maketecheasier.com</link>
	<description>Uncomplicating the complicated, making life easier</description>
	<lastBuildDate>Fri, 20 Nov 2009 13:39:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>2 Useful SSH Tricks to Improve Your System Security</title>
		<link>http://maketecheasier.com/2-useful-ssh-tricks-to-improve-your-system-security/2009/07/02</link>
		<comments>http://maketecheasier.com/2-useful-ssh-tricks-to-improve-your-system-security/2009/07/02#comments</comments>
		<pubDate>Thu, 02 Jul 2009 12:33:53 +0000</pubDate>
		<dc:creator>Joshua Price</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[openssh]]></category>
		<category><![CDATA[scp]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sshfs]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=5407</guid>
		<description><![CDATA[A few days ago, Tavis wrote a great article on How to use SSH X-forwarding to Run Remote Apps.  X forwarding is indeed a very handy feature of SSH, so I thought it would be a good time to expand on some of the other great uses for this excellent piece of software (and [...]<p><strong><a href="http://maketecheasier.com/2-useful-ssh-tricks-to-improve-your-system-security/2009/07/02">2 Useful SSH Tricks to Improve Your System Security</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)</p>



Related posts:<ol><li><a href='http://maketecheasier.com/use-ssh-x-forwarding-to-run-remote-apps/2009/06/22' rel='bookmark' title='Permanent Link: How to use SSH X-forwarding to Run Remote Apps'>How to use SSH X-forwarding to Run Remote Apps</a></li><li><a href='http://maketecheasier.com/create-a-private-encrypted-folder-on-ubuntu-hardy-with-ecryptfs/2008/09/25' rel='bookmark' title='Permanent Link: Create a Private Encrypted Folder On Ubuntu Hardy With eCryptfs'>Create a Private Encrypted Folder On Ubuntu Hardy With eCryptfs</a></li><li><a href='http://maketecheasier.com/a-quick-look-at-microsoft-security-essentials-free-antivirus-software/2009/06/24' rel='bookmark' title='Permanent Link: A Quick Look At Microsoft Security Essentials Free Antivirus Software'>A Quick Look At Microsoft Security Essentials Free Antivirus Software</a></li><li><a href='http://maketecheasier.com/basic-bash-command-for-new-linux-users/2008/01/22' rel='bookmark' title='Permanent Link: Basic Bash Command For New Linux Users'>Basic Bash Command For New Linux Users</a></li><li><a href='http://maketecheasier.com/mount-iso-images-in-windows/2009/05/19' rel='bookmark' title='Permanent Link: How to Mount ISO Images In Windows'>How to Mount ISO Images In Windows</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-5642" src="http://images.maketecheasier.com/2009/07/openssh-logo.png" alt="OpenSSH Logo" width="194" height="191" />A few days ago, Tavis wrote a great article on <a href="http://maketecheasier.com/use-ssh-x-forwarding-to-run-remote-apps/2009/06/22">How to use SSH X-forwarding to Run Remote Apps</a>.  X forwarding is indeed a very handy feature of SSH, so I thought it would be a good time to expand on some of the other great uses for this excellent piece of software (and some related tools).  Today, we&#8217;ll cover SCP and SSHFS.</p>
<p>To follow this guide, you&#8217;ll need the following:</p>
<p>- Client computer with openssh-client installed (for Windows, use Putty)<br />
- Server computer with openssh-server installed (Available on any UNIX-style system)<br />
- A working set of login credentials on the server</p>
<p>If you don&#8217;t have a computer with an SSH server, you can use the same PC as both client and server for the sake of trying all this out.  If you do have a (Linux, Unix, BSD) computer available to act as server, make sure to install the OpenSSH server software.  Debian and Ubuntu users can get this easily with</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> openssh-server</pre></div></div>

<h3>1. Using SSH to securely copy files</h3>
<p>This is my second favorite use for SSH.  When you install the OpenSSH client on your machine, it typically comes with a file copy tool called SCP (<strong>S</strong>ecure <strong>C</strong>o<strong>p</strong>y).  This can be VERY useful as a way to not only send files to your friends (who have openssh-server running) but to do it in a completely encrypted way.</p>
<p>For example, a friend of mine in Michigan is a studio engineer.  He mixes audio tracks for a recording studio.  Sometimes, when he wants a second opinion, he&#8217;ll send me what he&#8217;s working on so I can give him my opinion.  Now, since this is all copyrighted music which has not even been released to the public, he&#8217;s naturally reluctant to post it on a filesharing service or web site, and the files are often too large for email.  Instead, we transfer using SCP.</p>
<p>The format for an scp command is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> filename user<span style="color: #000000; font-weight: bold;">@</span>remote-host:<span style="color: #000000; font-weight: bold;">/</span>where<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>save<span style="color: #000000; font-weight: bold;">/</span>it</pre></div></div>

<p>So my friend, on the other side of the country, would enter something like</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> MyNewMix.wav nick<span style="color: #000000; font-weight: bold;">@</span>joshs-computer.com:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>nick<span style="color: #000000; font-weight: bold;">/</span>mixes</pre></div></div>

<p>This example is assuming my computer is accessible from <em>joshs-computer.com</em> and that he has a user account on it named <em>nick</em>.  His file will be copied to my computer over a fully encrypted connection without having to be stored at some third-party website or email server.</p>
<h3>2. Mount a network drive securely</h3>
<p>Now here is my #1 favorite use of SSH.  If you&#8217;re a Linux user, you&#8217;re probably familiar with mounting drives.  You have a device like a cdrom drive (say, /dev/hdc for example), and to access it, you mount it to a directory such as /media/cdrom.  Well you can use that same principle with a program called SSHFS to mount a filesystem over a network/internet and attach it to a directory on your computer.</p>
<p>SSHFS is not part of the standard openssh package.  It&#8217;s a separately developed program that you&#8217;ll install independently using your normal package manager.</p>
<p>Let&#8217;s go back to the example with my friend at the studio.  Perhaps he&#8217;s got several new mixes for me instead of just one, or perhaps we do this so often that using SCP to transfer back and forth starts to become a hassle.  Well, if he&#8217;s got openssh-server installed and I have an account on his computer, I can mount his hard drive to any directory I wish.  The command follows the structure:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">sshfs user<span style="color: #000000; font-weight: bold;">@</span>remote-host:<span style="color: #000000; font-weight: bold;">/</span>what<span style="color: #000000; font-weight: bold;">/</span>I<span style="color: #000000; font-weight: bold;">/</span>want <span style="color: #000000; font-weight: bold;">/</span>where<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>put<span style="color: #000000; font-weight: bold;">/</span>it</pre></div></div>

<p>So to connect to Nick&#8217;s computer I&#8217;d use something like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">sshfs josh<span style="color: #000000; font-weight: bold;">@</span>nicks-computer.com:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>nick<span style="color: #000000; font-weight: bold;">/</span>mixes <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>josh<span style="color: #000000; font-weight: bold;">/</span>nicks-computer</pre></div></div>

<p>That would make it so that any time I access the folder /home/josh/nicks-computer from my machine, it would actually connect to Nick&#8217;s computer over SSH and give me access to all those files just as if they were sitting in a normal directory on my computer.  Any changes I make are made to the files on his computer, it&#8217;s completely transparent.  I can use whatever audio software I like to work with the files, they are completely oblivious to the fact that they&#8217;re really reading the file from 2500 miles away.</p>
<p>A word of warning about SSHFS:  since it&#8217;s reading the files over the internet instead of locally, combined with the encryption overhead, SSHFS can be <strong>SLOW</strong>.  You probably wouldn&#8217;t want to use it to access files that need lots of speed or are constantly being read or written.</p>
<p>There are many great uses for SSH and related tools.  I&#8217;d love to hear what other tricks you may have.  SSH tunneling, for example, can be hugely beneficial for some people, but doing it justice would require an article of its own.  Do you have any other tips to get the most out of SSH?</p>
<p><p><script type="text/javascript"><!--
google_ad_client = "pub-8765285789552883";
/* MTE body ad300x250, created 5/17/09 */
google_ad_slot = "3980792036";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p></p>
<p><strong><a href="http://maketecheasier.com/2-useful-ssh-tricks-to-improve-your-system-security/2009/07/02">2 Useful SSH Tricks to Improve Your System Security</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)</p>


<p>Related posts:<ol><li><a href='http://maketecheasier.com/use-ssh-x-forwarding-to-run-remote-apps/2009/06/22' rel='bookmark' title='Permanent Link: How to use SSH X-forwarding to Run Remote Apps'>How to use SSH X-forwarding to Run Remote Apps</a></li><li><a href='http://maketecheasier.com/create-a-private-encrypted-folder-on-ubuntu-hardy-with-ecryptfs/2008/09/25' rel='bookmark' title='Permanent Link: Create a Private Encrypted Folder On Ubuntu Hardy With eCryptfs'>Create a Private Encrypted Folder On Ubuntu Hardy With eCryptfs</a></li><li><a href='http://maketecheasier.com/a-quick-look-at-microsoft-security-essentials-free-antivirus-software/2009/06/24' rel='bookmark' title='Permanent Link: A Quick Look At Microsoft Security Essentials Free Antivirus Software'>A Quick Look At Microsoft Security Essentials Free Antivirus Software</a></li><li><a href='http://maketecheasier.com/basic-bash-command-for-new-linux-users/2008/01/22' rel='bookmark' title='Permanent Link: Basic Bash Command For New Linux Users'>Basic Bash Command For New Linux Users</a></li><li><a href='http://maketecheasier.com/mount-iso-images-in-windows/2009/05/19' rel='bookmark' title='Permanent Link: How to Mount ISO Images In Windows'>How to Mount ISO Images In Windows</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/2-useful-ssh-tricks-to-improve-your-system-security/2009/07/02/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
