snipt

Ctrl+h for KB shortcuts

Bash

grep ssh

1
2
3
4
5
6
grep what_youre_looking_for file_youre_looking_in

# example
grep domain.com error_log

# must be in correct directory
https://snipt.net/embed/ef8635cde92e7f7c7203962a59ad90c3/
/raw/ef8635cde92e7f7c7203962a59ad90c3/
ef8635cde92e7f7c7203962a59ad90c3
bash
Bash
6
2019-08-22T01:24:02
True
False
False
/api/public/snipt/3095/
grep-ssh
<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>grep what_youre_looking_for file_youre_looking_in </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1"># example</span> </span><span id="L-4"><a name="L-4"></a>grep domain.com error_log </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="c1"># must be in correct directory</span> </span></pre></div> </td></tr></table>
grep, ssh

Bash

connect to mysql database (gs) Grid-Service

mysql -h external-db.#####.gridserver.com -udb###### -p########
https://snipt.net/embed/2df4e9f14d349dad13898be74d2b33a9/
/raw/2df4e9f14d349dad13898be74d2b33a9/
2df4e9f14d349dad13898be74d2b33a9
bash
Bash
1
2019-08-24T17:45:23
True
False
False
/api/public/snipt/2952/
connect-to-mysql-database-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>mysql -h external-db.#####.gridserver.com -udb###### -p######## </span></pre></div> </td></tr></table>
"(gs) grid-service", mysql, ssh

Text only

Generate SSH public/private key

ssh-keygen -t rsa -b 2048
https://snipt.net/embed/f6609b0f2bab1d1a271ab068a2352f7a/
/raw/f6609b0f2bab1d1a271ab068a2352f7a/
f6609b0f2bab1d1a271ab068a2352f7a
text
Text only
1
2019-08-24T17:45:57
True
False
False
/api/public/snipt/2916/
generate-ssh-publicprivate-key
<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>ssh-keygen -t rsa -b 2048 </span></pre></div> </td></tr></table>
ssh

Text only

Run Synergy via SSH

1
2
3
4
5
6
run on server:
synergys -a 127.0.0.1 -c /path/to/synergy.conf

run on client:
ssh -N -f -L 24800:localhost:24800 [email protected]
synergyc localhost
https://snipt.net/embed/964b2705cf65282d5ba1c66d8f6ba628/
/raw/964b2705cf65282d5ba1c66d8f6ba628/
964b2705cf65282d5ba1c66d8f6ba628
text
Text only
6
2019-08-24T16:56:10
True
False
False
/api/public/snipt/2633/
run-synergy-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> <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>run on server: </span><span id="L-2"><a name="L-2"></a>synergys -a 127.0.0.1 -c /path/to/synergy.conf </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>run on client: </span><span id="L-5"><a name="L-5"></a>ssh -N -f -L 24800:localhost:24800 [email protected] </span><span id="L-6"><a name="L-6"></a>synergyc localhost </span></pre></div> </td></tr></table>
client, server, ssh, synergy

Bash

passwordless RSA ssh 1-liner

ssh [email protected] 'test -d .ssh || mkdir -m 0700 .ssh ; cat >> .ssh/authorized_keys && chmod 0600 .ssh/*' < ~/.ssh/id_rsa.pub 
https://snipt.net/embed/178d12a904d346f71a8fa2e42bcd66a8/
/raw/178d12a904d346f71a8fa2e42bcd66a8/
178d12a904d346f71a8fa2e42bcd66a8
bash
Bash
1
2019-08-24T17:46:16
True
False
False
/api/public/snipt/2170/
passwordless-rsa-ssh-1-liner
<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>ssh [email protected] <span class="s1">&#39;test -d .ssh || mkdir -m 0700 .ssh ; cat &gt;&gt; .ssh/authorized_keys &amp;&amp; chmod 0600 .ssh/*&#39;</span> &lt; ~/.ssh/id_rsa.pub </span></pre></div> </td></tr></table>
passwordless, ssh

Python

Change your ssh keys password

ssh-keygen -f id_rsa -p
https://snipt.net/embed/b22d44dd3e8300a73a6b640c5303bca9/
/raw/b22d44dd3e8300a73a6b640c5303bca9/
b22d44dd3e8300a73a6b640c5303bca9
python
Python
1
2019-08-24T17:46:38
True
False
False
/api/public/snipt/1998/
change-your-ssh-keys-password
<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="n">ssh</span><span class="o">-</span><span class="n">keygen</span> <span class="o">-</span><span class="n">f</span> <span class="n">id_rsa</span> <span class="o">-</span><span class="n">p</span> </span></pre></div> </td></tr></table>
password, ssh

Bash

ssh without login

1
2
3
4
5
6
7
#generate ssh key if you don't have yet
ssh-keygen -t rsa

cat .ssh/id_rsa.pub | ssh [email protected] 'cat >> .ssh/authorized_keys'

chmod 700 .ssh
chmod 640 .ssh/authorized_keys
https://snipt.net/embed/864d57b2c765927688b74e96f2939baa/
/raw/864d57b2c765927688b74e96f2939baa/
864d57b2c765927688b74e96f2939baa
bash
Bash
7
2019-08-24T17:47:28
True
False
False
/api/public/snipt/1997/
ssh-without-login
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">#generate ssh key if you don&#39;t have yet</span> </span><span id="L-2"><a name="L-2"></a>ssh-keygen -t rsa </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>cat .ssh/id_rsa.pub <span class="p">|</span> ssh [email protected] <span class="s1">&#39;cat &gt;&gt; .ssh/authorized_keys&#39;</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>chmod <span class="m">700</span> .ssh </span><span id="L-7"><a name="L-7"></a>chmod <span class="m">640</span> .ssh/authorized_keys </span></pre></div> </td></tr></table>
ssh

Text only

SSH

1
2
3
ssh [email protected] – connect to host as user 
ssh -p port [email protected] – connect to host on port port as user 
ssh-copy-id [email protected] – add your key to host for user to enable a keyed or passwordless login
https://snipt.net/embed/1787d7646304c5d987cf4e64a3973dc7/
/raw/1787d7646304c5d987cf4e64a3973dc7/
1787d7646304c5d987cf4e64a3973dc7
text
Text only
3
2019-08-21T10:00:52
True
False
False
/api/public/snipt/817/
ssh
<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>ssh [email protected] – connect to host as user </span><span id="L-2"><a name="L-2"></a>ssh -p port [email protected] – connect to host on port port as user </span><span id="L-3"><a name="L-3"></a>ssh-copy-id [email protected] – add your key to host for user to enable a keyed or passwordless login </span></pre></div> </td></tr></table>
linux, ssh, unix

Bash

ssh fwd bf enc

ssh -c blowfish -L 3333:localhost:
https://snipt.net/embed/2eef31c05c35529ab0ecdb029a6f1816/
/raw/2eef31c05c35529ab0ecdb029a6f1816/
2eef31c05c35529ab0ecdb029a6f1816
bash
Bash
1
2019-08-24T17:21:12
True
False
False
/api/public/snipt/800/
ssh-fwd-bf-enc
<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>ssh -c blowfish -L 3333:localhost: </span></pre></div> </td></tr></table>
shell, ssh, tunnel