ssh-keygen more explanation and example

This commit is contained in:
Philip Sargent 2021-12-19 14:56:48 +00:00
parent 3ff44c97dc
commit 4bb6fac7af

View File

@ -45,7 +45,7 @@
</ol>
<p>This is an example of the whole interaction where the key file has been given a different name:
<pre>
<tt>$ <b>ssh-keygen -C "philip@muscogee-wsl"</b>
<code>$ <b>ssh-keygen -C "philip@muscogee-wsl"</b>
Generating public/private rsa key pair.
Enter file in which to save the key (/home/philip/.ssh/id_rsa): <b>id_rsa_wsl</b>
Enter passphrase (empty for no passphrase):
@ -67,9 +67,40 @@ The key's randomart image is:
|oo |
+----[SHA256]-----+
$
</tt>
</code>
</pre>
<p>This will enable ssh login instantly. Check that it has worked by logging in to the expo server like this:
<code>
$ <b>ssh expo@expo.survex.com</b>
</code>
<h4>If it didn't work</h4>
<p>You may get this response if the public key has not been loaded properly on the server or if your laptop has not loaded the secret key properly.
<code>
expo@expo.survex.com: Permission denied (publickey).
</code>
<ol>
<li>Check that <var>ssh-keygen</var> has put both files into your Linux home <var>.ssh</var> folder on your laptop,
if not, then move them there:
<code>
$ mv id_rsa_wsl* ~/.ssh
</code>
where <b>id_rsa_wsl</b> is the 'file in which to save the key' you specified above.
<br><br></li>
<li>Check that the ssh agent process is running and fix it if it is not (full details of how to do this
give at <a href="https://www.ssh.com/academy/ssh/agent">www.ssh.com/academy/ssh/agent</a>)
<code>
$ ssh-add -l
</code>
and if the process is not running, start it like this
<code>
$ eval `ssh-agent`
</code>
Check that the key is loaded by running <var>ssh-add -l</var> and then test that you can login again.
<br><br></li>
</ol>
<p>If it still doesn't work, read <href="https://www.ssh.com/academy/ssh/keygen">the online
documentation</a>, start from scratch, and do it all again but this time using all the defaults and without trying to be clever.
<h3>MacOS</h3>
<li>Erm, dunno...please fill in</li>