<?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>NerdyRoom™ &#187; ssh</title>
	<atom:link href="http://www.nrtm.de/index.php/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nrtm.de</link>
	<description>never read the manual</description>
	<lastBuildDate>Mon, 06 Feb 2012 21:02:39 +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>ssh-argv0: for the lazzy &#8216;ssh&#8217; typer</title>
		<link>http://www.nrtm.de/index.php/2009/06/09/ssh-argv0-for-the-lazzy-ssh-typer/</link>
		<comments>http://www.nrtm.de/index.php/2009/06/09/ssh-argv0-for-the-lazzy-ssh-typer/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 16:57:06 +0000</pubDate>
		<dc:creator>bert</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=1250</guid>
		<description><![CDATA[Those of us who often use often ssh to login or start remote commands will find this useful: $ ln -s /usr/bin/ssh-argv ~/bin/$HOST $ $HOST You can use the FQDN of the host of course, but a short alias is even more shorter. Put this in your .ssh/config and use the alias for the link: [...]]]></description>
			<content:encoded><![CDATA[<p>Those of us who often use often ssh to login or start remote commands will find this useful:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ssh-argv ~<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOST</span>
$ <span style="color: #007800;">$HOST</span></pre></div></div>

<p>You can use the FQDN of the host of course, but a short alias is even more shorter. Put this in your .ssh/config and use the alias for the link:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Host <span style="color: #007800;">$FQDN</span> <span style="color: #007800;">$ALIAS</span>
  HostName <span style="color: #007800;">$FQDN</span></pre></div></div>

<p>And yes, you want to put both <code>$FQDN</code> and <code>$ALIAS</code> in the Host line. If you ever add more options to this Host entry you want to apply it to both <code>$FQDN</code> and <code>$ALIAS</code>. If you omit <code>$FQDN</code> the options will only apply to the <code>$ALIAS</code>.</p>
 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=1250&amp;md5=351f8c283e3559f11fca10ea1ec7db01" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2009/06/09/ssh-argv0-for-the-lazzy-ssh-typer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=1250&amp;md5=351f8c283e3559f11fca10ea1ec7db01" type="text/html" />
	</item>
		<item>
		<title>Connection sharing with OpenSSH &#8211; 3rd Update</title>
		<link>http://www.nrtm.de/index.php/2009/05/26/connection-sharing-with-openssh/</link>
		<comments>http://www.nrtm.de/index.php/2009/05/26/connection-sharing-with-openssh/#comments</comments>
		<pubDate>Tue, 26 May 2009 09:05:39 +0000</pubDate>
		<dc:creator>bert</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=998</guid>
		<description><![CDATA[Want to speed up your svn/cvs operations? Want fast path completions for scp commands? Than you should enable the connection sharing feature from OpenSSH. The essence is, that your first connection to a remote host acts as a master connection. All subsequent connection attempts will use the master connection to re-use the connection of the [...]]]></description>
			<content:encoded><![CDATA[<p>Want to speed up your svn/cvs operations?  Want fast path completions for scp commands?  Than you should enable the connection sharing feature from OpenSSH.</p>
<p>The essence is, that your first connection to a remote host acts as a master connection.  All subsequent connection attempts will use the master connection to re-use the connection of the master.</p>
<p>What you save is the repeated authentication procedure, especially if you use passwd authentication.</p>
<p>First you need to create a directory where all master connections create a socket so that other clients can find already established connections and communicate with the master.</p>
<p style="padding-left: 30px;">

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>masters
$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> 0700 ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>masters</pre></div></div>

<p>Next we need to enable the feature in your <code>~/.ssh/config</code>:</p>
<p style="padding-left: 30px;">

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ControlMaster auto
ControlPath <span style="color: #ff0000;">&quot;~/.ssh/masters/%r@%h:%p&quot;</span></pre></div></div>

<p>The <code>ControlPath</code> is a format string where <code>%r</code> is the remote user name, <code>%h</code> the remote host, and <code>%p</code> the port. If your <code>~/.ssh</code> directory is on a mounted share, you should also include a <code>%l</code> for the local host.  So that you can connect to a remote from multiple hosts.</p>
<p style="padding-left: 30px;">

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ControlPath <span style="color: #ff0000;">&quot;~/.ssh/masters/%l -&gt; %r@%h:%p&quot;</span></pre></div></div>

<p>It would be nice to put these into separate directories, but OpenSSH does not create directories.</p>
<p>If you try this out you will probably encounter a problem.  If your master is a interactive shell and you close it, ssh will not return to the console if other clients still use this shared connection.</p>
<p>To circumvent this you can start a ssh process into the back ground:</p>
<p style="padding-left: 30px;">

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-nNf</span> host</pre></div></div>

<p>You can also use sshfs to act as the master:</p>
<p style="padding-left: 30px;">

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ sshfs host: mntpoint</pre></div></div>

<p>I still haven&#8217;t found a nice way to make this somehow automatic. My wish would be a hook into the NetworkManager to get notified when a network connection is established.  With this one can automatically connect to predefined hosts.</p>
<p>A second problem, which most of you will only notice if your computer hangs-up periodically and you try to reconnect after the restart, is that ssh complains that it can not use the still existing socket in the <code>masters</code> directories. The problem was more on my side and the solution is obvious:</p>
<p>Set the <code>ControlMaster</code> to <code>no</code> in the <code>~/.ssh/config</code> file.</p>
<p>In this mode (which is the default) the client tries to connect to a master and fallbacks to a <em>normal</em> connection if it fails.</p>
<p>Now you need to start your master connection explicitly with the <code>ControlMaster=yes</code> option:</p>
<p style="padding-left: 30px;">

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-nNf</span> <span style="color: #660033;">-o</span> <span style="color: #007800;">ControlMaster</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> host</pre></div></div>

<p>or</p>
<p style="padding-left: 30px;">

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ sshfs <span style="color: #660033;">-o</span> <span style="color: #007800;">ControlMaster</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> host: mntpoint</pre></div></div>

<p>respectively.</p>
<h4>Supplement 1:</h4>
<p>To close a master connection initiated with <code>ssh -nNf ...</code> run this:</p>
<p style="padding-left: 30px;">

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-O</span> <span style="color: #7a0874; font-weight: bold;">exit</span> host</pre></div></div>

<h4>Supplement 2:</h4>
<p>Now to the fun part:</p>
<p>I just hacked a formidable solution to the problem, when to start the master control. And by <strong>hacked</strong> I mean it.</p>
<p>Get the latest OpenSSH portable package and extract it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>mirror.roothell.org<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>OpenBSD<span style="color: #000000; font-weight: bold;">/</span>OpenSSH<span style="color: #000000; font-weight: bold;">/</span>portable<span style="color: #000000; font-weight: bold;">/</span>openssh-5.2p1.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> xf openssh-5.2p1.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> openssh-5.2p1</pre></div></div>

<p>Now safe the following patch as <code>controlcommand.patch</code> and apply it to the source:</p>
<pre class="brush: diff; title: ; toolbar: true; wrap-lines: false; notranslate">diff --git a/mux.c b/mux.c
index 79f8376..1b07bab 100644
--- a/mux.c
+++ b/mux.c
@@ -518,6 +518,9 @@ muxclient(const char *path)
/* FALLTHROUGH */
case SSHCTL_MASTER_NO:
break;
+	case SSHCTL_MASTER_COMMAND:
+		debug(&quot;command-mux: Start control command&quot;);
+		break;
default:
return;
}
@@ -534,13 +537,22 @@ muxclient(const char *path)
if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) &lt; 0)
fatal(&quot;%s socket(): %s&quot;, __func__, strerror(errno));

+retry:
if (connect(sock, (struct sockaddr *)&amp;addr, addr_len) == -1) {
if (muxclient_command != SSHMUX_COMMAND_OPEN) {
fatal(&quot;Control socket connect(%.100s): %s&quot;, path,
strerror(errno));
}
if (errno == ENOENT)
-			debug(&quot;Control socket \&quot;%.100s\&quot; does not exist&quot;, path);
+			if (options.control_master != SSHCTL_MASTER_COMMAND ||
+			    options.control_command == NULL) {
+				debug(&quot;Control socket \&quot;%.100s\&quot; does not exist&quot;, path);
+			} else {
+				int rc = ssh_local_cmd(options.control_command);
+				debug(&quot;Executing control command: %.500s: %d&quot;, options.control_command, rc);
+				if (!rc)
+					goto retry;
+			}
else {
error(&quot;Control socket connect(%.100s): %s&quot;, path,
strerror(errno));
diff --git a/readconf.c b/readconf.c
index 53fc6c7..f2be9c5 100644
--- a/readconf.c
+++ b/readconf.c
@@ -128,8 +128,9 @@ typedef enum {
oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout,
oAddressFamily, oGssAuthentication, oGssDelegateCreds,
oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
-	oSendEnv, oControlPath, oControlMaster, oHashKnownHosts,
-	oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
+	oSendEnv, oControlPath, oControlMaster, oControlCommand,
+	oHashKnownHosts, oTunnel, oTunnelDevice,
+	oLocalCommand, oPermitLocalCommand,
oVisualHostKey, oZeroKnowledgePasswordAuthentication,
oDeprecated, oUnsupported
} OpCodes;
@@ -222,6 +223,7 @@ static struct {
{ &quot;sendenv&quot;, oSendEnv },
{ &quot;controlpath&quot;, oControlPath },
{ &quot;controlmaster&quot;, oControlMaster },
+	{ &quot;controlcommand&quot;, oControlCommand },
{ &quot;hashknownhosts&quot;, oHashKnownHosts },
{ &quot;tunnel&quot;, oTunnel },
{ &quot;tunneldevice&quot;, oTunnelDevice },
@@ -856,6 +858,8 @@ parse_int:
value = SSHCTL_MASTER_ASK;
else if (strcmp(arg, &quot;autoask&quot;) == 0)
value = SSHCTL_MASTER_AUTO_ASK;
+		else if (strcmp(arg, &quot;command&quot;) == 0)
+			value = SSHCTL_MASTER_COMMAND;
else
fatal(&quot;%.200s line %d: Bad ControlMaster argument.&quot;,
filename, linenum);
@@ -863,6 +867,10 @@ parse_int:
*intptr = value;
break;

+	case oControlCommand:
+		charptr = &amp;options-&gt;control_command;
+		goto parse_string;
+
case oHashKnownHosts:
intptr = &amp;options-&gt;hash_known_hosts;
goto parse_flag;
@@ -1057,6 +1065,7 @@ initialize_options(Options * options)
options-&gt;num_send_env = 0;
options-&gt;control_path = NULL;
options-&gt;control_master = -1;
+	options-&gt;control_command = NULL;
options-&gt;hash_known_hosts = -1;
options-&gt;tun_open = -1;
options-&gt;tun_local = -1;
diff --git a/readconf.h b/readconf.h
index 8fb3a85..93255a0 100644
--- a/readconf.h
+++ b/readconf.h
@@ -112,6 +112,7 @@ typedef struct {

char	*control_path;
int	control_master;
+	char	*control_command;

int	hash_known_hosts;

@@ -130,6 +131,7 @@ typedef struct {
#define SSHCTL_MASTER_AUTO	2
#define SSHCTL_MASTER_ASK	3
#define SSHCTL_MASTER_AUTO_ASK	4
+#define SSHCTL_MASTER_COMMAND	5

void     initialize_options(Options *);
void     fill_default_options(Options *);
diff --git a/ssh.c b/ssh.c
index 9d43bb7..02f1960 100644
--- a/ssh.c
+++ b/ssh.c
@@ -212,6 +212,7 @@ main(int ac, char **av)
extern char *optarg;
struct servent *sp;
Forward fwd;
+	char *host_arg;

/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
@@ -547,6 +548,9 @@ main(int ac, char **av)
if (!host)
usage();

+	/* safe the hostname given on the command-line */
+	host_arg = host;
+
SSLeay_add_all_algorithms();
ERR_load_crypto_strings();

@@ -622,6 +626,9 @@ main(int ac, char **av)
&amp;options, 0);
}

+	if (options.hostname != NULL)
+		host = options.hostname;
+
/* Fill configuration defaults. */
fill_default_options(&amp;options);

@@ -651,15 +658,12 @@ main(int ac, char **av)
cp = options.local_command;
options.local_command = percent_expand(cp, &quot;d&quot;, pw-&gt;pw_dir,
&quot;h&quot;, options.hostname? options.hostname : host,
-                    &quot;l&quot;, thishost, &quot;n&quot;, host, &quot;r&quot;, options.user, &quot;p&quot;, buf,
+                    &quot;l&quot;, thishost, &quot;n&quot;, host_arg, &quot;r&quot;, options.user, &quot;p&quot;, buf,
&quot;u&quot;, pw-&gt;pw_name, (char *)NULL);
debug3(&quot;expanded LocalCommand: %s&quot;, options.local_command);
xfree(cp);
}

-	if (options.hostname != NULL)
-		host = options.hostname;
-
/* force lowercase for hostkey matching */
if (options.host_key_alias != NULL) {
for (p = options.host_key_alias; *p; p++)
@@ -672,12 +676,12 @@ main(int ac, char **av)
xfree(options.proxy_command);
options.proxy_command = NULL;
}
+
if (options.control_path != NULL &amp;&amp;
strcmp(options.control_path, &quot;none&quot;) == 0) {
xfree(options.control_path);
options.control_path = NULL;
}
-
if (options.control_path != NULL) {
char thishost[NI_MAXHOST];

@@ -691,6 +695,32 @@ main(int ac, char **av)
&quot;r&quot;, options.user, &quot;l&quot;, thishost, (char *)NULL);
xfree(cp);
}
+
+	if (options.control_command != NULL &amp;&amp;
+	    strcmp(options.control_command, &quot;none&quot;) == 0) {
+		xfree(options.control_command);
+		options.control_command = NULL;
+	}
+	if (options.control_command != NULL &amp;&amp; options.control_path != NULL) {
+		char thishost[NI_MAXHOST];
+
+		if (gethostname(thishost, sizeof(thishost)) == -1)
+			fatal(&quot;gethostname: %s&quot;, strerror(errno));
+		snprintf(buf, sizeof(buf), &quot;%d&quot;, options.port);
+		cp = options.control_command;
+		options.control_command = percent_expand(cp,
+		    &quot;l&quot;, thishost,
+		    &quot;h&quot;, options.hostname ?: host,
+		    &quot;p&quot;, buf,
+		    &quot;r&quot;, options.user,
+		    &quot;n&quot;, host_arg,
+		    &quot;u&quot;, pw-&gt;pw_name,
+		    &quot;d&quot;, pw-&gt;pw_dir,
+		    &quot;s&quot;, options.control_path,
+		    (char *)NULL);
+		xfree(cp);
+	}
+
if (muxclient_command != 0 &amp;&amp; options.control_path == NULL)
fatal(&quot;No ControlPath specified for \&quot;-O\&quot; command&quot;);
if (options.control_path != NULL)
diff --git a/sshconnect.c b/sshconnect.c
index c04aa10..9d6e6c2 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1155,8 +1155,7 @@ ssh_local_cmd(const char *args)
pid_t pid;
int status;

-	if (!options.permit_local_command ||
-	    args == NULL || !*args)
+	if (args == NULL || !*args)
return (1);

if ((shell = getenv(&quot;SHELL&quot;)) == NULL)
</pre>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-p1</span> <span style="color: #000000; font-weight: bold;">&lt;</span> controlcommand.patch</pre></div></div>

<p><code>configure</code> and build openssh with <code>--bindir=$HOME/bin</code> and use <code>$DESTDIR</code> to install the complete package:
</pre>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #007800;">DESTDIR</span>=<span style="color: #007800;">$PWD</span><span style="color: #000000; font-weight: bold;">/</span>root install-nosysconf</pre></div></div>

<p>Copy the binaries into your <code>PATH</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$PWD</span><span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">ssh</span>,<span style="color: #c20cb9; font-weight: bold;">scp</span>,sftp<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin</pre></div></div>

<p>Change your <code>~/.ssh/config</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ControlMaster <span style="color: #7a0874; font-weight: bold;">command</span>
ControlCommand <span style="color: #ff0000;">&quot;ssh-cc.sh %h&quot;</span></pre></div></div>

<p>Finally put this script as <code>ssh-cc.sh</code> somewhere into your PATH:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-nNf</span> <span style="color: #660033;">-o</span> <span style="color: #007800;">ControlMaster</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #ff0000;">&quot;$1&quot;</span></pre></div></div>

<p>I used a script to put some sshfs mounts into this.</p>
<p>To be sure your tools use the new ssh command add something like this into a proper file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GIT_SSH</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ssh</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CVS_RSH</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ssh</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">RSYNC_RSH</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ssh</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">SVN_SSH</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ssh</span></pre></div></div>

 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=998&amp;md5=29f7bc06c1bcdca2c3c40fbf2c488473" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2009/05/26/connection-sharing-with-openssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=998&amp;md5=29f7bc06c1bcdca2c3c40fbf2c488473" type="text/html" />
	</item>
		<item>
		<title>Terminating SSH Sessions</title>
		<link>http://www.nrtm.de/index.php/2009/05/14/terminating-ssh-sessions/</link>
		<comments>http://www.nrtm.de/index.php/2009/05/14/terminating-ssh-sessions/#comments</comments>
		<pubDate>Thu, 14 May 2009 11:27:28 +0000</pubDate>
		<dc:creator>jupp</dc:creator>
				<category><![CDATA[bashism]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/index.php/2009/05/14/terminating-ssh-sessions/</guid>
		<description><![CDATA[I think we all know the problem: a ssh session hangs for some reason, either because you are no longer connected to that wifi or because the remote host just crashed. A more elegant solution than closing your local term (or killing the ssh client) consists of a well hidden feature: by sequentially pressing the [...]]]></description>
			<content:encoded><![CDATA[<p>I think we all know the problem: a ssh session hangs for some reason, either because you are no longer connected to that wifi or because the remote host just crashed.</p>
<p>A more elegant solution than closing your local term (or killing the ssh client) consists of a well hidden feature:<br />
by sequentially pressing the three keys <b>Return ~ .</b>  you can exit the client and return to your local prompt.</p>
 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=935&amp;md5=ce62ec79069e450905302824e10ddde5" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2009/05/14/terminating-ssh-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=935&amp;md5=ce62ec79069e450905302824e10ddde5" type="text/html" />
	</item>
		<item>
		<title>@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @</title>
		<link>http://www.nrtm.de/index.php/2009/02/24/warning-remote-host-identification-has-changed/</link>
		<comments>http://www.nrtm.de/index.php/2009/02/24/warning-remote-host-identification-has-changed/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 21:16:21 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[nerdcore]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[spoofing]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh-keygen]]></category>
		<category><![CDATA[warning]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=158</guid>
		<description><![CDATA[Ach ja, jeden Tag nutzt man ssh aber eigentlich hat man keine Ahnung davon Hand auf Herz Leute, was macht ihr wenn &#8220;WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!&#8221; in der Kommandozeile steht? Genau, vim ~/.ssh/known_hosts und die Zeile für den betreffenden Host löschen. Das man das eigentlich nicht so machen sollte steht auf einem ganz [...]]]></description>
			<content:encoded><![CDATA[<p>Ach ja, jeden Tag nutzt man ssh aber eigentlich hat man keine Ahnung davon <img src='http://www.nrtm.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Hand auf Herz Leute, was macht ihr wenn &#8220;WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!&#8221; in der Kommandozeile steht? Genau,</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>known_hosts</pre></div></div>

<p>und die Zeile für den betreffenden Host löschen. Das man das eigentlich nicht so machen sollte steht auf einem ganz anden Blatt. Wie es eigentlich geht? So:</p>
<p>Auf meinem Laptop kommt der Fehler:</p>
<pre>[21:46:24][robin@robin-laptop:~]$ ssh vpv
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for vpv has changed,
and the key for the according IP address 141.xxx.xxx.2
is unchanged. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Offending key for IP in /home/robin/.ssh/known_hosts:54
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
cf:86:16:04:13:e9:15:6c:8d:b3:45:4e:5c:ff:57:65.
Please contact your system administrator.
Add correct host key in /home/robin/.ssh/known_hosts to get rid of this message.
Offending key in /home/robin/.ssh/known_hosts:53
RSA host key for vpv has changed and you have requested strict checking.
Host key verification failed.</pre>
<p>Wichtig ist dabei der Fingerprint der mir mitgeteilt wird (cf:86:16:&#8230;). Dieser muss gegengecheckt werden. Dazu habe ich zwei Möglichkeiten. Entweder ich geh zum Admin der Kiste und frage ihn nach dem aktuellen Fingerprint (Was schlecht ist wenn man selber Admin ist und den Fingerprint nicht im Kopf hat <img src='http://www.nrtm.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ). Oder, ich checke ihn mit der eines Clients bei dem es ohne Warnmeldung funktioniert. Das geht so:</p>
<p>Auf zum Beispiel meiner Workstation kann ich mich ohne Probleme auf den Server verbinden. Dann checke ich dort mit</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh
<span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-l</span> <span style="color: #660033;">-f</span> known_hosts
<span style="color: #000000;">1024</span> cf:<span style="color: #000000;">86</span>:<span style="color: #000000;">16</span>:04:<span style="color: #000000;">13</span>:e9:<span style="color: #000000;">15</span>:6c:8d:b3:<span style="color: #000000;">45</span>:4e:5c:ff:<span style="color: #000000;">57</span>:<span style="color: #000000;">65</span> vpv,<span style="color: #000000;">141</span>.xxx.xxx.2</pre></td></tr></table></div>

<p>den Fingerprint gegen. Ist der Fingerprint aus der Warnmeldung identisch mit dem auf meiner Workstation kann ich mich ohne Bedenken ans Löschen der betreffenden known_hosts Zeile machen.</p>
 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=158&amp;md5=3915664816241812dc3b254f071a4e14" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2009/02/24/warning-remote-host-identification-has-changed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=158&amp;md5=3915664816241812dc3b254f071a4e14" type="text/html" />
	</item>
	</channel>
</rss>

