<?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>Richard Jones, Esq. &#187; ssh</title>
	<atom:link href="http://www.metabrew.com/article/tag/ssh/feed" rel="self" type="application/rss+xml" />
	<link>http://www.metabrew.com</link>
	<description>Erlang, PHP, C, C++, Java, PostgreSQL, MySQL, Hadoop, Linux, awk, bash, sed, grep, screen, vim, irc, ssh etc...</description>
	<lastBuildDate>Sun, 20 Dec 2009 18:59:32 +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>ssh hack: connect directly to machine via a firewall box</title>
		<link>http://www.metabrew.com/article/ssh-hack-connect-directly-to-machine-via-a-firewall-box/</link>
		<comments>http://www.metabrew.com/article/ssh-hack-connect-directly-to-machine-via-a-firewall-box/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 17:44:44 +0000</pubDate>
		<dc:creator>RJ</dc:creator>
				<category><![CDATA[hacks]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.metabrew.com/?p=196</guid>
		<description><![CDATA[UPDATED 23/03/2009: added &#8220;-q0&#8243; option to clean up netcat after session terminates, and left another useful ssh tip in the comments. It&#8217;s common to have to ssh to firewall / gateway machine, then ssh to the machine you want to work on within a server network. Typically you&#8217;d do this from your local machine: $ [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATED 23/03/2009:</strong> added &#8220;-q0&#8243; option to clean up netcat after session terminates, and left another useful ssh tip in the comments.</p>
<p>It&#8217;s common to have to ssh to firewall / gateway machine, then ssh to the machine you want to work on within a server network.<br />
Typically you&#8217;d do this from your local machine:<br />
<code>$ ssh firewall.example.com<br />
Password:<br />
$ ssh my-private-host</code></p>
<p>I finally got bored of doing this, and created the following file, <strong><code>/usr/bin/sssh</code></strong></p>
<pre>#!/bin/bash
ssh -oproxycommand="ssh -q firewall.example.com nc -q0 %h %p" $*</pre>
<p>Now I can use the <code>sssh</code> command to connect to hosts using the firewall machine as a proxy. Like most good hacks, this uses netcat.</p>
<p>Eg:<br />
<code>$ sssh 10.1.2.3</code><br />
Will connect me directly to a machine on the server network, via the firewall box. Seeing as it passes all parameters to ssh (the <code>$*</code> bit) you can do port forwards and X-forwarding as usual too:</p>
<pre>$ sssh -L 5432:localhost:5432 my-vm</pre>
<p>This lets me tunnel the port for a PostgreSQL running on my development vm (<code>my-vm</code>) in a single command. I have all my keys installed, so no passwords needed &#8211; I estimate this will save me about 60 seconds every day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabrew.com/article/ssh-hack-connect-directly-to-machine-via-a-firewall-box//feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
