mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 11:32:39 +02:00
87 lines
No EOL
3.6 KiB
HTML
87 lines
No EOL
3.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<title>
|
|
Astuces <span class="caps">SSH</span> - Alexis Métaireau </title>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet"
|
|
href="https://blog.notmyidea.org/theme/css/main.css?v2"
|
|
type="text/css" />
|
|
<link href="https://blog.notmyidea.org/feeds/all.atom.xml"
|
|
type="application/atom+xml"
|
|
rel="alternate"
|
|
title="Alexis Métaireau ATOM Feed" />
|
|
</head>
|
|
<body>
|
|
<div id="content">
|
|
<section id="links">
|
|
<ul>
|
|
<li>
|
|
<a class="main" href="/">Alexis Métaireau</a>
|
|
</li>
|
|
<li>
|
|
<a class=""
|
|
href="https://blog.notmyidea.org/journal/index.html">Journal</a>
|
|
</li>
|
|
<li>
|
|
<a class="selected"
|
|
href="https://blog.notmyidea.org/code/">Code, etc.</a>
|
|
</li>
|
|
<li>
|
|
<a class=""
|
|
href="https://blog.notmyidea.org/weeknotes/">Notes hebdo</a>
|
|
</li>
|
|
<li>
|
|
<a class=""
|
|
href="https://blog.notmyidea.org/lectures/">Lectures</a>
|
|
</li>
|
|
<li>
|
|
<a class=""
|
|
href="https://blog.notmyidea.org/projets.html">Projets</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
|
|
<header>
|
|
<h1 class="post-title">Astuces <span class="caps">SSH</span></h1>
|
|
<time datetime="2012-12-27T00:00:00+01:00">27 décembre 2012</time>
|
|
|
|
|
|
</header>
|
|
<article>
|
|
|
|
<h2 id="tunelling">Tunelling</h2>
|
|
<p>Parce que je m’en rapelle jamais (tête de linote):</p>
|
|
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>ssh<span class="w"> </span>-f<span class="w"> </span>hote<span class="w"> </span>-L<span class="w"> </span>local:lolnet.org:destination<span class="w"> </span>-N
|
|
</code></pre></div>
|
|
|
|
<h2 id="sshconfig">.ssh/config</h2>
|
|
<p>(merci <a href="http://majerti.fr">gaston</a> !)</p>
|
|
<p>La directive suivante dans .ssh/config permet de sauter d’hôte en hôte
|
|
séparés par des “+” :</p>
|
|
<div class="highlight"><pre><span></span><code>Host <span class="gs">*+*</span>
|
|
ProxyCommand ssh $(echo %h | sed
|
|
's/+[^+]*$//;s/\([^+%%]*\)%%\([^+]*\)$/\2 -l \1/;s/:/ -p /')
|
|
PATH=.:\$PATH nc -w1 $(echo %h | sed 's/^.*+//;/:/!s/$/ %p/;s/:/ /')
|
|
</code></pre></div>
|
|
|
|
<p>On peut donc spécifier des “sauts” ssh du style:</p>
|
|
<div class="highlight"><pre><span></span><code><span class="n">ssh</span><span class="w"> </span><span class="n">root</span><span class="mf">@91.25.25.25</span><span class="o">+</span><span class="mf">192.168.1.1</span>
|
|
</code></pre></div>
|
|
|
|
<p>Ensuite on peut essayer de rajouter:</p>
|
|
<div class="highlight"><pre><span></span><code>Host <label_pour_mon_serveur_privé>
|
|
user <monuser(root)>
|
|
IdentityFile <chemin vers ma clé ssh pour le serveur publique>
|
|
hostname ip_serveur_publique+ip_serveur_privé
|
|
</code></pre></div>
|
|
</article>
|
|
<footer>
|
|
<a id="feed" href="/feeds/all.atom.xml">
|
|
<img alt="RSS Logo" src="/theme/rss.svg" />
|
|
</a>
|
|
</footer>
|
|
</div>
|
|
</body>
|
|
</html> |