Issue # 1 – no key or gen a new key.
Simple, just run ssh-keygen
ssh-keygen
Output like…
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:dZjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx60 root@rtr.dmz.alshowto.com
The key's randomart image is:
+---[RSA 2048]----+
| |
| . E*oo*+.|
+----[SHA256]-----+
Issue 2 – ssh commands cause error
So, I only have this one but it is a long error so I put it in a sub heading.
Could not open a connection to your authentication agent.
So simplified answer, is ssh needs to know what shell script to send command to. The below code worked for me.
ssh-agent /bin/sh
It will cause the shell to be cleared from [2.6.0-RELEASE][admin@rtr.dmz.alshowto.com]/root: to
simply, #
This indicates you are in a sh script. At least that is what I understand it to be. Comment below if you know more on this than I. Also, once this is done it appears this sticks and ssh commands work as expected. Such as:
Then, I ran the ssh-add to associate the newly generated key from Issue 1 to ssh so it would use it for connections in the future.
# ssh-add ~/.ssh/id_rsa
Now, this works as I would have expected all along.
[2.6.0-RELEASE][admin@rtr.dmz.alshowto.com]/root: ssh root@192.168.2.4