snipt

Ctrl+h for KB shortcuts

Bash

My rsync command

rsync -rtv --delete --size-only --progress -e ssh $ORIGIN $USER@$SERVER:~/$DEST
https://snipt.net/embed/93186811decde1b8c3660cf677f2e4b0/
/raw/93186811decde1b8c3660cf677f2e4b0/
93186811decde1b8c3660cf677f2e4b0
bash
Bash
1
2019-06-15T13:49:45
True
False
False
/api/public/snipt/27840/
my-rsync-command
<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>rsync -rtv --delete --size-only --progress -e ssh <span class="nv">$ORIGIN</span> <span class="nv">$USER</span>@<span class="nv">$SERVER</span>:~/<span class="nv">$DEST</span> </span></pre></div> </td></tr></table>
rsync, sftp, ssh

PHP

brodcast a message on a server via ssh

echo "Hello Everybody" | wall
https://snipt.net/embed/4f69dea2e9a094d4fcd79dbc6661344d/
/raw/4f69dea2e9a094d4fcd79dbc6661344d/
4f69dea2e9a094d4fcd79dbc6661344d
php
PHP
1
2019-06-07T22:53:22
True
False
False
/api/public/snipt/23286/
brodcast-a-message-on-a-server-via-ssh
<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><span class="x">echo &quot;Hello Everybody&quot; | wall</span> </span></pre></div> </td></tr></table>
ssh

Bash

rsync over ssh

rsync -vaz --rsh="ssh -l username" ~/folder targetHost:~/
https://snipt.net/embed/2d1e2ddebe807544419c35b462eba3e5/
/raw/2d1e2ddebe807544419c35b462eba3e5/
2d1e2ddebe807544419c35b462eba3e5
bash
Bash
1
2019-06-05T12:13:34
True
False
False
/api/public/snipt/22401/
rsync-over-ssh-1
<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>rsync -vaz --rsh<span class="o">=</span><span class="s2">&quot;ssh -l username&quot;</span> ~/folder targetHost:~/ </span></pre></div> </td></tr></table>
ssh, syncing

Python

Reverse ssh tunnel

1
2
3
4
5
6
# Reverse ssh tunnel:
# Host to access -> destination.host.net ; user=dest_user
dest_user@destination.host.net$ ssh -R 22000:localhost:22 -f -N src_user@source.host.net
 
# Source host    -> source.host.net      ; user=src_user
src_user@source.host.net$ ssh -p 22000 dest_user@localhost
https://snipt.net/embed/495effb16259fb9061487ecf1c583d42/
/raw/495effb16259fb9061487ecf1c583d42/
495effb16259fb9061487ecf1c583d42
python
Python
7
2019-06-06T00:29:36
True
False
False
/api/public/snipt/21956/
reverse-ssh-tunnel-1
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Reverse ssh tunnel:</span> </span><span id="L-2"><a name="L-2"></a><span class="c1"># Host to access -&gt; destination.host.net ; user=dest_user</span> </span><span id="L-3"><a name="L-3"></a><span class="n">dest_user</span><span class="nd">@destination.host.net</span><span class="err">$</span> <span class="n">ssh</span> <span class="o">-</span><span class="n">R</span> <span class="mi">22000</span><span class="p">:</span><span class="n">localhost</span><span class="p">:</span><span class="mi">22</span> <span class="o">-</span><span class="n">f</span> <span class="o">-</span><span class="n">N</span> <span class="n">src_user</span><span class="nd">@source.host.net</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="c1"># Source host -&gt; source.host.net ; user=src_user</span> </span><span id="L-6"><a name="L-6"></a><span class="n">src_user</span><span class="nd">@source.host.net</span><span class="err">$</span> <span class="n">ssh</span> <span class="o">-</span><span class="n">p</span> <span class="mi">22000</span> <span class="n">dest_user</span><span class="nd">@localhost</span> </span></pre></div> </td></tr></table>
reverse, ssh, tunneling

Batchfile

Create ssh proxy (with key)

@echo off
plink -ssh -C -N -D 8080 [email protected] -i c:\mykey.ppk
https://snipt.net/embed/595937d5ea5ff72028746a677f9f5291/
/raw/595937d5ea5ff72028746a677f9f5291/
595937d5ea5ff72028746a677f9f5291
bat
Batchfile
2
2019-06-08T09:29:06
True
False
False
/api/public/snipt/20556/
create-ssh-proxy-with-key
<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="p">@</span><span class="k">echo</span> off </span><span id="L-2"><a name="L-2"></a>plink -ssh -C -N -D 8080 [email protected] -i c:\mykey.ppk </span></pre></div> </td></tr></table>
network, proxy, putty, ssh, windows

Bash

SSH COPY Copy files between hosts

1
2
3
scp [email protected]:directorio/ArchivoOrigen ArchivoDestino

scp ArchivoOrigen [email protected]:directorio/ArchivoDestino
https://snipt.net/embed/a9141aa4a3f0daa7c2f517cb3744baae/
/raw/a9141aa4a3f0daa7c2f517cb3744baae/
a9141aa4a3f0daa7c2f517cb3744baae
bash
Bash
3
2019-06-13T03:55:53
True
False
False
/api/public/snipt/19037/
ssh-copy-copy-files-between-hosts
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>scp [email protected]:directorio/ArchivoOrigen ArchivoDestino </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>scp ArchivoOrigen [email protected]:directorio/ArchivoDestino </span></pre></div> </td></tr></table>
command, copy, scp, ssh, sysadmin, terminal