<?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>killianfaughnan.com &#187; tunneling</title>
	<atom:link href="http://killianfaughnan.com/tag/tunneling/feed/" rel="self" type="application/rss+xml" />
	<link>http://killianfaughnan.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Wed, 23 Feb 2011 09:05:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>SSH Forwarding</title>
		<link>http://killianfaughnan.com/2008/11/19/ssh-forwarding/</link>
		<comments>http://killianfaughnan.com/2008/11/19/ssh-forwarding/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 23:08:36 +0000</pubDate>
		<dc:creator>kfaughnan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tunnel]]></category>
		<category><![CDATA[tunneling]]></category>

		<guid isPermaLink="false">http://killianfaughnan.com/?p=73</guid>
		<description><![CDATA[The basis for this particular article (and most of the info) came from one of the guys I work with, Gavin McCullagh, who I&#8217;m pretty sure knows more stuff than is good for him. It&#8217;s all pretty handy stuff, but can be irritating to get working Forwarding X Server If you want to forward an [...]]]></description>
			<content:encoded><![CDATA[<p>The basis for this particular article (and most of the info) came from one of the guys I work with, Gavin McCullagh, who I&#8217;m pretty sure knows more stuff than is good for him. It&#8217;s all pretty handy stuff, but can be irritating to get working</p>
<h3>Forwarding X Server</h3>
<p>If you want to forward an X session to another machine you can use the following command to do so.</p>
<pre>  ssh -X remotepc.example.com</pre>
<p>Now if we want to we can just start an application in the terminal session opened by the above command, and the application will run on the remote computer, but be displayed on our local machine. i.e. if you were to run nautilus on the remote server sshtest we would just type the following at the command prompt:</p>
<pre>  remotepc$ nautilus</pre>
<p>This is the same for most applications. You will need the application installed on both machines however. Also note that firefox requires additional switches in order to run in this fashion as you can see below.</p>
<pre>  remotepc$ firefox -noshm</pre>
<h3>Double Forwarding X Server</h3>
<p>It is possible to string multiple ssh sessions together in order to run an application on a machine in an otherwise unreachable location. For instance if you wanted to run firefox on a machine that was behind a firewall, to access a locally restricted site, but the firewall would only allow ssh from particular machines outside the network. In this instance you could ssh to the machine which is allowed past the firewall, and then set up a second ssh session to connect to the machine inside the firewall, and run firefox through the connection. See below:</p>
<pre>  ssh -CtX outsidepc.example.com ssh -X insidepc.example.com firefox -noshm</pre>
<p>In the above command we are using a couple of switches. These are</p>
<pre><strong><em>-C</em></strong>  This will compress the connection</pre>
<pre><em><strong>-t</strong></em>  The -t option will instruct ssh to open a new terminal upon connection.
    This is required if you want to string ssh sessions together</pre>
<pre><em><strong>-X</strong></em>  This will pass the X aapplication through the connection</pre>
<h3>Port Forwarding</h3>
<p>You can use ssh to forward ports from a remote machine to your own. The main application I would use this for myself if for retrieving my gmail in <a title="Mutt Email Client" href="http://www.mutt.org" target="_blank">mutt</a> while in work as we block the required ports.  To do this I would issue something like the following command:</p>
<pre>ssh -gL 192.168.1.1:993:imap.googlemail.com:993 -gL
 587:smtp.googlemail.com:587 killian@example.com</pre>
<p>In this example the server at.example.com should be a machine on which it is possible to access these ports. i.e. either a machine with access through the firewall or in your <a title="DMZ Definition" href="http://en.wikipedia.org/wiki/Demilitarized_zone_(computing)" target="_blank">DMZ</a>. Once you have used this command you can just open up your email client normally and the port on the remote pc will listen for connections and they will then be passed on to your own machine.</p>
]]></content:encoded>
			<wfw:commentRss>http://killianfaughnan.com/2008/11/19/ssh-forwarding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

