WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: OpenSSH  (Read 1593 times)

Offline djca

  • Newbie
  • *
  • Posts: 22
OpenSSH
« on: March 15, 2017, 06:37:50 AM »
Hello
I have the following strange case and I am not sure what is the problem.
When I generate ssh keys (rsa and dsa) without passphrase I am able to load them with sshd without problem.
But when I use some passphrase to generate the keys I am not able to load sshd with the following error:
Could not load host key: rsa.key
Could not load host key: dsa.key

What could be the problem?
I am using TC 7.2 32bit
Regards
djca

Offline djca

  • Newbie
  • *
  • Posts: 22
Re: OpenSSH
« Reply #1 on: March 22, 2017, 08:58:48 AM »
After a couple of days I succeded to start the daemon :)
Just in case someone else is trying the same, these are the steps:
1.) you generate the keys with ssh-keygen ( actually only rsa key is enough to start the sshd). It generates the keys in home/tc/.ssh/id_rsa folder. If you enter passphrase it will encrypt them.

ssh-keygen -t rsa

2.) you start the ssh-agent

eval $(ssh-agent -s)
to export the correct env variables.

3.) you add the private key to the agent

ssh-add id_rsa

4.) inside the config file of sshd_config you must add an undocumented parameter HostKeyAgent equal to SSH_AUTH_SOCK variable or you will recieve incorrect passphrase error

sudo /usr/local/sbin/sshd -f sshd_config

If everything is ok the daemon must start listening.
Now you can encrypt your private key even better  with PBKDF but this is another story.

Regards.
djca.