snipt

Ctrl+h for KB shortcuts

Text only

Avoid Enter passphrase for...

1
2
3
4
5
6
7
8
ssh-add

If "Could not open a connection to your authentication agent.", then

eval $(ssh-agent)
ssh-add

\o/
https://snipt.net/embed/8786882fd9c872f025a66b9de151e88b/
https://snipt.net/raw/8786882fd9c872f025a66b9de151e88b/
8786882fd9c872f025a66b9de151e88b
text
Text only
8
2016-05-04T03:07:52
True
False
Jan 26, 2016 at 07:55 AM
/api/public/snipt/143842/
avoid-enter-passphrase-for
<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 id="L-1"><a name="L-1"></a>ssh-add </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>If &quot;Could not open a connection to your authentication agent.&quot;, then </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>eval $(ssh-agent) </span><span id="L-6"><a name="L-6"></a>ssh-add </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a>\o/ </span></pre></div> </td></tr></table>
passphrase, ssh

Bash

bugfix "Could not load host key /etc/ssh/ssh_host_..."

1
2
3
# error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
# Regenerates any missing keys:
$ ssh-keygen -A
https://snipt.net/embed/6ac532ae5b57a28cfd810f876f7bb91f/
https://snipt.net/raw/6ac532ae5b57a28cfd810f876f7bb91f/
6ac532ae5b57a28cfd810f876f7bb91f
bash
Bash
4
2016-05-04T00:02:25
True
False
Feb 03, 2015 at 11:54 PM
/api/public/snipt/138107/
bugfix-could-not-load-host-key-etcsshssh_host_-7f87c683
<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 id="L-1"><a name="L-1"></a><span class="c"># error: Could not load host key: /etc/ssh/ssh_host_ed25519_key</span> </span><span id="L-2"><a name="L-2"></a><span class="c"># Regenerates any missing keys:</span> </span><span id="L-3"><a name="L-3"></a><span class="nv">$ </span>ssh-keygen -A </span></pre></div> </td></tr></table>
aws, linux, ssh, ssh-keygen, ubuntu

Shell Session

Import sql file to MySQL database using SSH

mysql -p -u DB_USERNAME DB_NAME < PATH/TO/FILE.sql
https://snipt.net/embed/2889d808e26a0fbea9ed3b8e1bfeeecf/
https://snipt.net/raw/2889d808e26a0fbea9ed3b8e1bfeeecf/
2889d808e26a0fbea9ed3b8e1bfeeecf
shell-session
Shell Session
1
2016-05-04T14:05:32
True
False
Feb 17, 2014 at 05:03 PM
/api/public/snipt/114552/
import-sql-file-to-mysql-database-using-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 id="L-1"><a name="L-1"></a><span class="go">mysql -p -u DB_USERNAME DB_NAME &lt; PATH/TO/FILE.sql</span> </span></pre></div> </td></tr></table>
database, mysql, sql, ssh, terminal

Shell Session

Mount remote server drive with OSXFUSE and ssh

sshfs [-p PORT-NUMBER] USERNAME@MYDOMAIN.com:/remote/path /Local/Path/to/an/existing/folder
https://snipt.net/embed/178080a463bae7bdfcf47a9de1f1fd0b/
https://snipt.net/raw/178080a463bae7bdfcf47a9de1f1fd0b/
178080a463bae7bdfcf47a9de1f1fd0b
shell-session
Shell Session
1
2016-05-02T21:21:27
True
False
Feb 05, 2014 at 09:52 AM
/api/public/snipt/111141/
mount-remote-server-drive-with-osxfuse-and-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 id="L-1"><a name="L-1"></a><span class="go">sshfs [-p PORT-NUMBER] USERNAME@MYDOMAIN.com:/remote/path /Local/Path/to/an/existing/folder</span> </span></pre></div> </td></tr></table>
commandline, mac, server, ssh, terminal

Bash

SCP file from local to remote server over ssh using pem key

scp -i /path/to/key.pem /path/to/file.jpg <username>@<server ip address>:/path/to/place/file
https://snipt.net/embed/e1839c5e3d32b62b6ee527d714e4b2f8/
https://snipt.net/raw/e1839c5e3d32b62b6ee527d714e4b2f8/
e1839c5e3d32b62b6ee527d714e4b2f8
bash
Bash
1
2016-05-04T19:01:49
True
False
/api/public/snipt/87287/
scp-file-from-local-to-remote-server-over-ssh-using-pem-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 id="L-1"><a name="L-1"></a>scp -i /path/to/key.pem /path/to/file.jpg &lt;username&gt;@&lt;server ip address&gt;:/path/to/place/file </span></pre></div> </td></tr></table>
copy, file, local, remote, scp, server, ssh, to

Bash

Clear contents of file but dont delete it

cat /dev/null > file
https://snipt.net/embed/bb4c74f5bb5471cfee5e14aa071214d5/
https://snipt.net/raw/bb4c74f5bb5471cfee5e14aa071214d5/
bb4c74f5bb5471cfee5e14aa071214d5
bash
Bash
1
2016-04-30T05:54:40
True
False
Sep 03, 2013 at 05:12 AM
/api/public/snipt/78646/
clear-contents-of-file-but-dont-delete-it
<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 id="L-1"><a name="L-1"></a>cat /dev/null &gt; file </span></pre></div> </td></tr></table>
bash, clear, linux, ssh

Text only

Disable ssh host key checking in Linux

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@server
https://snipt.net/embed/259724021f8d5001ce10aeed11e33b0f/
https://snipt.net/raw/259724021f8d5001ce10aeed11e33b0f/
259724021f8d5001ce10aeed11e33b0f
text
Text only
1
2016-04-30T10:34:08
True
False
Jul 26, 2013 at 05:12 AM
/api/public/snipt/69685/
disable-ssh-host-key-checking-in-linux
<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 id="L-1"><a name="L-1"></a>ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@server </span></pre></div> </td></tr></table>
Linux, host-key-checking, ssh
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.