<?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>BigSmoke &#187; SSH</title>
	<atom:link href="http://blog.bigsmoke.us/tag/ssh/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.bigsmoke.us</link>
	<description>Smokes your problems, coughs fresh air.</description>
	<lastBuildDate>Sat, 04 Feb 2012 11:10:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Checking 3ware raid controllers over ssh with nagios</title>
		<link>http://blog.bigsmoke.us/2010/10/04/checking-3ware-raid-controllers-over-ssh-with-nagios</link>
		<comments>http://blog.bigsmoke.us/2010/10/04/checking-3ware-raid-controllers-over-ssh-with-nagios#comments</comments>
		<pubDate>Mon, 04 Oct 2010 15:21:07 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[3ware]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1603</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
First check <a href="http://blog.bigsmoke.us/2010/10/04/configuring-nagios-checks-over-ssh">this</a> to see how you enable a host to be checked with nagios over SSH.
</p>

<p>
Create a command in /etc/nagios3/commands.cfg:
</p>

<pre class="php"><span style="color: #808080; font-style: italic;"># This command needs this in /etc/sudoers on the target:</span>
<span style="color: #808080; font-style: italic;"># nagios ALL = NOPASSWD: /usr/local/sbin/check_3ware.sh</span>
<a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> command <span style="color: #66cc66;">&#123;</span>
       command_name     check_3ware
       command_line     /usr/lib/nagios/plugins/check_by_ssh -H <span style="color: #0000ff;">$HOSTADDRESS</span>$ -i /etc/nagios3/id_rsa -l nagios -t <span style="color: #cc66cc;">25</span> -C <span style="color: #ff0000;">'sudo check_3ware.sh'</span>
<span style="color: #66cc66;">&#125;</span></pre>

<p>
Run visudo and add this line:
</p>

<pre class="php">nagios ALL = NOPASSWD: /usr/local/sbin/check_3ware.sh</pre>

<p>
Then install the script from <a href="http://www.roedie.nl/wiki/index.php/Nagios_3ware">here</a>. Last time I did that I needed to fix bugs in it, so beware. I submitted a patch, which will be accepted I guess.
</p>

<p>
Then go <a href="http://www.lsi.com/channel/ChannelDownloads/Default.aspx">download</a> the tw_cli tool.
</p>

<p>
Then create a hostgroup for your 3ware hosts:
</p>

<pre class="php"><a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> hostgroup <span style="color: #66cc66;">&#123;</span>
        hostgroup_name  3ware-machines
        alias           3Ware machines
        members         boxen
<span style="color: #66cc66;">&#125;</span></pre>

<p>
Then a service:
</p>

<pre class="php"><a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> service <span style="color: #66cc66;">&#123;</span>
        hostgroup_name                  3ware-machines
        service_description             3Ware status
        check_command                   check_3ware
        use                             generic-service
        notification_interval           <span style="color: #cc66cc;">0</span>
<span style="color: #66cc66;">&#125;</span></pre>

<p>
That should be it.
</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/10/04/checking-3ware-raid-controllers-over-ssh-with-nagios/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring nagios checks over SSH</title>
		<link>http://blog.bigsmoke.us/2010/10/04/configuring-nagios-checks-over-ssh</link>
		<comments>http://blog.bigsmoke.us/2010/10/04/configuring-nagios-checks-over-ssh#comments</comments>
		<pubDate>Mon, 04 Oct 2010 15:08:53 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1598</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
I had to do a lot of fiddling before I got nagios over ssh working. I used <a href="http://wiki.nagios.org/index.php/Howtos:checkbyssh_RedHat">this article</a> as source, mostly, even though I did it differently.
</p>

<p>
First add some commands to commands.cfg:
</p>

<pre class="php"><a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> command<span style="color: #66cc66;">&#123;</span>
        command_name    check_remote_disk
        command_line    /usr/lib/nagios/plugins/check_by_ssh -p <span style="color: #0000ff;">$ARG1</span>$ -l nagios -t <span style="color: #cc66cc;">30</span> -o StrictHostKeyChecking=no -i /etc/nagios3/id_rsa -H <span style="color: #0000ff;">$HOSTADDRESS</span>$ -C <span style="color: #ff0000;">'/usr/lib/nagios/plugins/check_disk -w $ARG2$ -c $ARG3$ -p $ARG4$'</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> command<span style="color: #66cc66;">&#123;</span>
        command_name    check_remote_load
        command_line    /usr/lib/nagios/plugins/check_by_ssh -p <span style="color: #0000ff;">$ARG1</span>$ -l nagios -t <span style="color: #cc66cc;">30</span> -o StrictHostKeyChecking=no -i /etc/nagios3/id_rsa -H <span style="color: #0000ff;">$HOSTADDRESS</span>$ -C <span style="color: #ff0000;">'/usr/lib/nagios/plugins/check_load -w $ARG2$ -c $ARG3$'</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> command<span style="color: #66cc66;">&#123;</span>
        command_name    check_remote_swap
        command_line    /usr/lib/nagios/plugins/check_by_ssh -p <span style="color: #0000ff;">$ARG1</span>$ -l nagios -t <span style="color: #cc66cc;">30</span> -o StrictHostKeyChecking=no -i /etc/nagios3/id_rsa -H <span style="color: #0000ff;">$HOSTADDRESS</span>$ -C <span style="color: #ff0000;">'/usr/lib/nagios/plugins/check_swap -w $ARG2$ -c $ARG3$'</span>
<span style="color: #66cc66;">&#125;</span></pre>

<p>
The file referenced by -i is an SSH secret key. You can create this key by running ssh-keygen and giving the right path. You can&#8217;t store anything in the nagios home dir, because that is in /var/run, which is cleared after a reboot. So, you can&#8217;t use the default key file.
</p>

<p>
The -t 30 is necessary because sometimes there is network lag, causing the service to be reported as failure. The default of 10 is not enough&#8230;
</p>

<p>
Next you need to create a user nagios on the target machine and add the .pub file of the key to the authorized_keys. Creating the user should be done like:
</p>

<pre class="php">useradd --<a href="http://www.php.net/system"><span style="color: #000066;">system</span></a> --shell /bin/bash nagios</pre>

<p>
Then install the nagios plugins on the target host:
</p>

<pre class="php">aptitude -P install nagios-plugins-basic</pre>

<p>
The nagios host needs to be able to log in with user nagios. On Debian, the user that runs nagios (also called &#8216;nagios&#8217;) doesn&#8217;t have a shell by default. So, give it a shell. 
</p>

<p>
Then you can create a hostgroup (for example). You can do:
</p>

<pre class="php"><a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> hostgroup <span style="color: #66cc66;">&#123;</span>
        hostgroup_name  nagios-enabled
        alias           Nagios enabled
        members         host1, host2
<span style="color: #66cc66;">&#125;</span></pre>

<p>
Then create services:
</p>

<pre class="php"><a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> service <span style="color: #66cc66;">&#123;</span>
        hostgroup_name                  nagios-enabled
        service_description             Root partition space
        check_command                   check_remote_disk!<span style="color: #cc66cc;">22</span>!<span style="color: #cc66cc;">20</span>%!<span style="color: #cc66cc;">10</span>%!/
        use                             generic-service
        notification_interval           <span style="color: #cc66cc;">0</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> service <span style="color: #66cc66;">&#123;</span>
        hostgroup_name                  nagios-enabled
        service_description             Swap space
        check_command                   check_remote_swap!<span style="color: #cc66cc;">22</span>!<span style="color: #cc66cc;">50</span>%!<span style="color: #cc66cc;">30</span>%
        use                             generic-service
        notification_interval           <span style="color: #cc66cc;">0</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> service <span style="color: #66cc66;">&#123;</span>
        hostgroup_name                  nagios-enabled
        service_description             Load
        check_command                   check_remote_load!<span style="color: #cc66cc;">22</span>!<span style="color: #cc66cc;">5.0</span>,<span style="color: #cc66cc;">4.0</span>,<span style="color: #cc66cc;">3.0</span>!<span style="color: #cc66cc;">10.0</span>,<span style="color: #cc66cc;">6.0</span>,<span style="color: #cc66cc;">4.0</span>
        use                             generic-service
        notification_interval           <span style="color: #cc66cc;">0</span>
<span style="color: #66cc66;">&#125;</span></pre>

<p>
This will check load, swap and root space on all your standard nagios enabled hosts. Next you can define custom services:
</p>

<pre class="php"><a href="http://www.php.net/define"><span style="color: #000066;">define</span></a> service <span style="color: #66cc66;">&#123;</span>
        host_name                       piet
        service_description             Some partition
        check_command                   check_remote_disk!<span style="color: #cc66cc;">22</span>!<span style="color: #cc66cc;">40</span>%!<span style="color: #cc66cc;">30</span>%!/mnt/dinklefat
        use                             generic-service
        notification_interval           <span style="color: #cc66cc;">0</span>
<span style="color: #66cc66;">&#125;</span></pre>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/10/04/configuring-nagios-checks-over-ssh/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up Rsync daemon</title>
		<link>http://blog.bigsmoke.us/2009/07/15/setting-up-rsync-daemon</link>
		<comments>http://blog.bigsmoke.us/2009/07/15/setting-up-rsync-daemon#comments</comments>
		<pubDate>Wed, 15 Jul 2009 14:01:41 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[rsyncd]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=719</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
What can you do when you want to backup your entire machine to a remote location but only have non-root shell access? You use rsyncd.
</p>

<p>
On the server you need to configure a module in <tt>/etc/rsyncd.conf</tt>:
</p>

<pre class="php"><span style="color: #66cc66;">&#91;</span>module_name<span style="color: #66cc66;">&#93;</span>
uid=<span style="color: #cc66cc;">0</span>
gid=<span style="color: #cc66cc;">0</span>
path=/path
transfer logging=no
read only=no</pre>

<p>
Then you need to rsync using a destination like <tt>user@host::module_name/</tt>
</p>

<p>
To make it work, you first need to set up a tunnel using SSH, because the rsync port (873) is not open in the firewall, most likely. So, you do this:
</p>

<pre class="php">ssh -N -L <span style="color: #cc66cc;">873</span>:localhost:<span style="color: #cc66cc;">873</span> user@host</pre>

<p>
I wrote a script to automate this all. Perhaps I will follow-up on this post sometime and post it.
</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2009/07/15/setting-up-rsync-daemon/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GNU Screen within Screen within [...]</title>
		<link>http://blog.bigsmoke.us/2009/01/11/gnu-screen-within-screen</link>
		<comments>http://blog.bigsmoke.us/2009/01/11/gnu-screen-within-screen#comments</comments>
		<pubDate>Sun, 11 Jan 2009 19:23:02 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Screen]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=233</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>GNU Screen is great. So great that I find myself always using it. (Pressing the Window key and T launches an <a href="/tag/xterm">XTerm</a> with a new Screen ready on my system, while I have to add Shift if I don&#8217;t want the screen.) This means that when I login into a some other machine through SSH&#8212;an occasion for which Screen is particularly useful&#8212;I will often end up with nested screens. So which Screen will receive my <kbd>Ctrl+a</kbd> presses?</p>

<p>The answer (courtesy of <a href="http://www.google.com/search?q=nested+screens">Google</a> and <a href="http://djkthx.blogspot.com/2007/10/nested-screen-sessions-rule.html">Yacin Nadji</a>) is that <kbd>Ctrl+a</kbd> will target the outer screen. Each <kbd>a</kbd> that you add after that will go down one nesting level.</p>

<p>Not that I don&#8217;t still find controlling nested screen confusing, but now at least I don&#8217;t feel helpless and stuck whenever it happens. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<h2>Extra tips</h2>

<ol>

<li>
<p>Visible captions make it easier:</p>
<div id="attachment_234" class="wp-caption alignnone" style="width: 734px"><a href="http://blog.bigsmoke.us/wp-factory/../uploads/2009/01/gnu-screen-within-screen-with-captions.png"><img src="http://blog.bigsmoke.us/wp-factory/../uploads/2009/01/gnu-screen-within-screen-with-captions.png" alt="GNU Screen within Screen with captions" title="GNU Screen within Screen with captions" width="724" height="94" class="size-full wp-image-234" /></a><p class="wp-caption-text">GNU Screen within Screen with captions</p></div>

<p>(If you don&#8217;t know how to configure Screen with captions, I&#8217;ve <a href="http://blog.bigsmoke.us/2008/12/04/gnu-screen-window-captions-as-xterm-tabs">blogged</a> about his previously.)</p>
</li>

<li><cite>Debian Administration</cite>, a very high-quality site has <a href="http://www.debian-administration.org/articles/34">an article</a> about GNU Screen.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2009/01/11/gnu-screen-within-screen/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Disabling SSH shell access for SVN users on a Linux/Unix system</title>
		<link>http://blog.bigsmoke.us/2008/08/04/disabling-ssh-shell-access-for-svn-users-on-a-linuxunix-system</link>
		<comments>http://blog.bigsmoke.us/2008/08/04/disabling-ssh-shell-access-for-svn-users-on-a-linuxunix-system#comments</comments>
		<pubDate>Mon, 04 Aug 2008 14:01:51 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=131</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
A common problem is that Linux/Unix system administrators want to grant users access to SVN repositories, but prevent them from logging in on the shell. This can be accomplished quite easily.
</p>

<p>
First, disable the user&#8217;s account by running:
</p>

<pre>
usermod --lock [user]
</pre>

<p>
This way, only public key authentication is allowed. Then, when adding the user&#8217;s key to the ~/.ssh/authorized_keys file, prefix it with this:
</p>

<pre>
command="/usr/local/bin/svnserve -t",no-port-forwarding,no-pty,no-agent-forwarding,no-X11-forwarding
</pre>

<p>
I used our wrapper script in /usr/local/bin as the command, because it sets an umask of 002 before actually running svnserve. This is necessary when using svn+ssh access.
</p>

<p>
<a href="http://svn.collab.net/repos/svn/trunk/notes/ssh-tricks">The source</a> for this trick explains it in more detail.
</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2008/08/04/disabling-ssh-shell-access-for-svn-users-on-a-linuxunix-system/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote pair programming with GNU Screen</title>
		<link>http://blog.bigsmoke.us/2008/07/23/pair-programming-through-gnu-screen</link>
		<comments>http://blog.bigsmoke.us/2008/07/23/pair-programming-through-gnu-screen#comments</comments>
		<pubDate>Wed, 23 Jul 2008 16:09:08 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Extreme Programming]]></category>
		<category><![CDATA[pair programming]]></category>
		<category><![CDATA[Screen]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[XTerm]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=101</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>I like pair programming. So much, in fact, that I want to do it even if I can&#8217;t look over the other person&#8217;s shoulder due to some geographical offset. Since I&#8217;m a real command-line freak, I can get what I want easily by using GNU Screen.</p>

<h2>GNU Screen rehash</h2>

<p>If you don&#8217;t know GNU screen yet and you ever find yourself using the command-line for an extended period of time, learn it. Now. I&#8217;ll name just a few advantages:</p>

<ol>
  <li>You can manage multiple &#8220;windows&#8221; conveniently even if you don&#8217;t have a tabbed terminal emulator, or even when you&#8217;re not within a graphic environment such as X.</li>
  <li>You can &#8220;detach&#8221; and &#8220;reattach&#8221; your Screen sessions and continue exactly where you left. This is very useful if you do your work on a remote server, through SSH, for example. Never by stumped by instable connections again!</li>
  <li>But, the feature which is most useful for pair programming is the ability to attach to the same session from multiple terminals.</li>
</ol>

<p>Starting GNU Screen is very easy. Just type <q><kbd>screen</kbd></q> at your shell prompt (or <q><kbd>screen -S SESSION_NAME</kbd></q> if you want your session to have an easy-to-remember name).</p>

<p>Press <kbd>CTRL+A</kbd> followed by <kbd>d</kbd> to detach. Exit your terminal. Start a new terminal, type <q><kbd>screen -r</kbd></q> and be amazed that you have your session back. <q><kbd>screen -r</kbd></q> can take as an argument the name or <abbr title="Process ID">PID</abbr> of the screen, which is useful if you have more than one screen running. To get a list of current screen sessions, type <q><kbd>screen -ls</kbd></q>.</p>

<h2>Inviting your observer</h2>

<p>The first thing you have to do is to add the following command to your <tt>.screenrc</tt> file:</p>

<pre>multiuser on</pre>

<p>If you don&#8217;t want to enable multiuser by default, you can also choose to type the command from within Screen each time that you need it. This is done by pressing <kbd>Ctrl+A</kbd>, followed by <kbd>:</kbd> and the command.</p>

<p>Myself, I prefer to have the command in my <tt>.screenrc</tt>. You need to admit users explicitly anyway. Admitting full access to a user is done by typing the <q><kbd>:acladd USERNAME</kbd></q> command (after pressing <kbd>Ctrl+A</kbd>). Then the given user can join this session by starting screen with <q><kbd>screen -x SESSION_OWNER/</kbd></q> where <tt>SESSION_OWNER</tt> is the driver.</p>

<h2>Get out of my driver&#8217;s seat! (Dealing with annoying observers)</h2>

<p>The <q><kbd>:acladd USERNAME</kbd></q> command will give the observer full read-write access. Maybe, if you have to deal with an observer who insists on taking the driver seat, you want to limit his or her access to read-only. This can be done just as easily: press <kbd>Ctrl+A</kbd>; then type <q><kbd>:aclchg USERNAME -w "#"</kbd></q>.

<h2>Make your terminals match</h2>

<p>Using a shared screen, it can be kind of annoying if your terminal sizes don&#8217;t match. As an observer, I fix this by asking the driver to tell me the values of the <tt>$ROWS</tt> and <tt>$COLS</tt> environment variables. If then, for example <tt>$COLS=110</tt> and <tt>$ROWS=40</tt>, I start my xterm with this in mind: <q><kbd>xterm -geometry 110x40</kbd></q></p>

<h2>Have fun with Screen!</h2>

<p>I&#8217;ve only touched upon some of the things you can do with screen. The manual page contains much more information&#8212;perhaps a bit too much even. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_confused.gif' alt=':-?' class='wp-smiley' /> </p>

<p>One of the things I also like to do with a shared screen session is remote system administration. If I want to perform delicate tasks as root, I find it kind of comforting if someone can stop me in time, before I do anything stupid. Besides, if you&#8217;re both root, you don&#8217;t even have to set permissions. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  So, it&#8217;s easy to.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2008/07/23/pair-programming-through-gnu-screen/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using an outgoing SSH tunnel from behind a NAT for incoming VNC</title>
		<link>http://blog.bigsmoke.us/2007/02/17/vnc-through-an-ssh-tunnel</link>
		<comments>http://blog.bigsmoke.us/2007/02/17/vnc-through-an-ssh-tunnel#comments</comments>
		<pubDate>Sat, 17 Feb 2007 22:50:06 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Azureus]]></category>
		<category><![CDATA[BitTorrent]]></category>
		<category><![CDATA[kvnc]]></category>
		<category><![CDATA[Laurelin Lucinda]]></category>
		<category><![CDATA[NAT]]></category>
		<category><![CDATA[OpenSSH]]></category>
		<category><![CDATA[PuTTY]]></category>
		<category><![CDATA[RealVNC]]></category>
		<category><![CDATA[Skype]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[VNC]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/2007/02/17/vnc-through-an-ssh-tunnel</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bigsmoke.us/laurelin-lucinda-van-der-molen/">Laurelin</a> is working as an Au Pair for a Greek family in&#8212;where else than <a href="http://laurelin.waarbenjij.nu/" hreflang="nl">Greece</a>. Her hostess has arranged for an Internet connection through <a href="http://en.wikipedia.org/wiki/Vivodi_Telecom">Vivodi Telecom</a> to allow Laurelin to maintain some form of contact with her friends and family at home.</p>

<p>Once connected, Laurelin quickly installed the <a href="http://azureus.sourceforge.net/">Azureus BitTorrent client</a> to be able to download some things (only legal things licensed under a liberal license, of course). Correct usage of the BitTorrent protocol implies opening up a port or two for incoming connections. After all, BitTorrent is all about sharing.</p>

<p>So, she needed help configuring port forwarding on the ADSL modem / NAT router (a microcom AD 2636) in Greece. She asked for this help two days ago while <a href="http://www.bigsmoke.us/wiebe-hedde-cazemier/">Wiebe</a> was looking at my screen, because we where doing an extreme programming session on a database schema using VNC and Skype. We interrupted our work hoping that we could easily solve her problem.</p>

<p>I had been looking at screenshots and manuals of her router and her modem&#8217;s administrative interface earlier when they couldn&#8217;t get the connection to work. After making sure that the problem was not a configuration or software problem and identifying that there was probably a problem between their modem and their telephone exchange, they later got their problem fixed. So, now I had to dig up the manual again. But, this time I could only find some screencaps which accompanied a useless tutorial in Greek. This exemplifies why I think it is useful to keep a blog.</p>

<p>So, Wiebe and I did our best to guide her through a GUI we couldn&#8217;t see and eventually she succeeded in defining a few forwards. However, they didn&#8217;t do their job. According to <a href="http://insecure.org/nmap/" title="nmap is a great port scanner">nmap</a> they were still filtered. She then installed <a href="http://www.realvnc.com/">RealVNC</a> server for us and added port 5900 to the list of forwarded ports. Wiebe tried to connect using the kvnc client, but no response. By that time, we had fooled around quite a bit and after mucking about a little more, we decided to postpone the rest and return to our database design. We decided for next time to let her use PuTTY to put a hole through the NAT router.</p>

<p>Today was the next time. She installed <a href="http://www.putty.nl/">PuTTY</a>. I gave her an account on the Debian server in our local LAN (I am behind a Windows terminal myself). Now she had to set up a tunnel and connect to that account:</p>

<div class="screenshot"><a href='http://blog.bigsmoke.us/uploads/2007/02/putty-vnc-remote-tunnel.jpg' title='Configuring a remote tunnel for VNC in PuTTY'><img src='http://blog.bigsmoke.us/uploads/2007/02/putty-vnc-remote-tunnel.jpg' alt='Configuring a remote tunnel for VNC in PuTTY' /></a></div>

<p>At this point, I still couldn&#8217;t access the tunnel between her box and the Debian machine from my Windows terminal:</p>

<pre class="php">$ netstat -l -n|grep <span style="color: #cc66cc;">5900</span>
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        <span style="color: #cc66cc;">0</span>      <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">127.0</span><span style="color: #cc66cc;">.0</span><span style="color: #cc66cc;">.1</span>:<span style="color: #cc66cc;">5900</span>          <span style="color: #cc66cc;">0.0</span><span style="color: #cc66cc;">.0</span><span style="color: #cc66cc;">.0</span>:*               LISTEN</pre>

<p>Since PuTTY was configured to let remote ports accept connections from other hosts, the problem had to be in the OpenSSH configuration on the Debian box. And indeed it was. I had to set the following option:</p>

<pre class="php">GatewayPorts yes</pre>

<p>After a restart of the OpenSSH daemon, she opened a tunnel which I could access from my own machine:</p>

<pre class="php">$ netstat -l -n|grep <span style="color: #cc66cc;">5900</span>
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        <span style="color: #cc66cc;">0</span>      <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0.0</span><span style="color: #cc66cc;">.0</span><span style="color: #cc66cc;">.0</span>:<span style="color: #cc66cc;">5900</span>            <span style="color: #cc66cc;">0.0</span><span style="color: #cc66cc;">.0</span><span style="color: #cc66cc;">.0</span>:*               LISTEN</pre>

<p>I could now control her desktop through the RealVNC viewer. Next time, I&#8217;ll need to actually <em>do</em> something with this connection.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2007/02/17/vnc-through-an-ssh-tunnel/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

