snipt

Ctrl+h for KB shortcuts

Bash

Kill an unresponsive ssh session

RET ~.
https://snipt.net/embed/107f31fdcedecba0ec5f6a29c47bcb2d/
/raw/107f31fdcedecba0ec5f6a29c47bcb2d/
107f31fdcedecba0ec5f6a29c47bcb2d
bash
Bash
1
2019-07-10T19:23:22
True
False
False
/api/public/snipt/14307/
kill-an-unresponsive-ssh-session
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>RET ~. </span></pre></div> </td></tr></table>
shell, ssh

Bash

ssh-agent

ssh-agent bash
ssh-add
https://snipt.net/embed/266afd044aec2d88e6aa5ed5f12e0a07/
/raw/266afd044aec2d88e6aa5ed5f12e0a07/
266afd044aec2d88e6aa5ed5f12e0a07
bash
Bash
2
2019-07-10T22:56:57
True
False
False
/api/public/snipt/12983/
ssh-agent
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>ssh-agent bash </span><span id="L-2"><a name="L-2"></a>ssh-add </span></pre></div> </td></tr></table>
bash, ssh, ssh-agent

Bash

SSH via TOR using SOCAT

1
2
3
4
5
6
7
8
# start TOR
tor

# create tunnel
socat TCP-LISTEN:<port> SOCKS4A:localhost:<host>:22,socksport=9050

# login through local tunnel
ssh <user>@localhost -p <port>
https://snipt.net/embed/cc9af9f9e0f1f606c4125996ea1f05da/
/raw/cc9af9f9e0f1f606c4125996ea1f05da/
cc9af9f9e0f1f606c4125996ea1f05da
bash
Bash
8
2019-07-11T14:01:36
True
False
False
/api/public/snipt/12029/
ssh-via-tor-using-socat
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># start TOR</span> </span><span id="L-2"><a name="L-2"></a>tor </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># create tunnel</span> </span><span id="L-5"><a name="L-5"></a>socat TCP-LISTEN:&lt;port&gt; SOCKS4A:localhost:&lt;host&gt;:22,socksport<span class="o">=</span>9050 </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="c1"># login through local tunnel</span> </span><span id="L-8"><a name="L-8"></a>ssh &lt;user&gt;@localhost -p &lt;port&gt; </span></pre></div> </td></tr></table>
socat, ssh, tor

Bash

gits from server backup per ssh

# run 'git-archive.sh' on server
scp -r -P 1234 [email protected]:~/git/*.tar.gz /g/git
https://snipt.net/embed/07b02008ae4eb1218c3ab987436ddc15/
/raw/07b02008ae4eb1218c3ab987436ddc15/
07b02008ae4eb1218c3ab987436ddc15
bash
Bash
2
2019-07-07T17:01:00
True
False
False
/api/public/snipt/10996/
gits-from-server-backup-per-ssh
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># run &#39;git-archive.sh&#39; on server</span> </span><span id="L-2"><a name="L-2"></a>scp -r -P <span class="m">1234</span> [email protected]:~/git/*.tar.gz /g/git </span></pre></div> </td></tr></table>
bash, git, ssh

Bash

Resume de descarga via SSH

alias scpresume="rsync --partial --progress --rsh=ssh"
scpresume archivo_origen [email protected]:/path_destino
https://snipt.net/embed/2c076e70d00f2a4b347ee2618a048ee0/
/raw/2c076e70d00f2a4b347ee2618a048ee0/
2c076e70d00f2a4b347ee2618a048ee0
bash
Bash
2
2019-07-21T04:20:38
True
False
False
/api/public/snipt/9824/
continua-descarga-via-ssh
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">alias</span> <span class="nv">scpresume</span><span class="o">=</span><span class="s2">&quot;rsync --partial --progress --rsh=ssh&quot;</span> </span><span id="L-2"><a name="L-2"></a>scpresume archivo_origen [email protected]:/path_destino </span></pre></div> </td></tr></table>
download, ssh, upload