mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-29 12:02:39 +02:00
58 lines
No EOL
2.1 KiB
HTML
58 lines
No EOL
2.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Astuces SSH - 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" 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>
|
|
<section id="links">
|
|
<li>
|
|
<a class="" href="https://blog.notmyidea.org/" id="site-title">Blog</a>
|
|
</li>
|
|
<li><a class="" href="https://blog.notmyidea.org/pages/projets.html">Projets</a></li>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<header>
|
|
<h1 class="post-title">Astuces SSH</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>$ ssh -f hote -L local:lolnet.org:destination -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 *+*
|
|
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="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>
|
|
|
|
</body>
|
|
</html> |