Add hosts to known_hosts for JSch 

Joined:
03/21/2010
Posts:
49

September 30, 2010 21:58:46    Last update: September 30, 2010 22:00:00
I had a lot of trouble adding a host to the known_hosts file with JSch. The readme says that if the property StrictHostKeyChecking is set to "no", JSch will automatically add the host to the known_hosts file. Or, if it is set to "ask", it will add the host after confirmation.

However, it did not mention which program to run the get that behavior. I tried Exec first. It did exhibit the behavior mentioned in the README, but it did not add to the known_hosts file. Then I tried KnownHosts, which did add the host to the known_hosts file. However, the only way to exit from the program is to hit CTRL-C, which also killed the cmd window.

It would have been a lot easier to use the cygwin ssh client and then copy the known_hosts file from cygwin home directory to "Documents and Settings\username\.ssh\".
Share |
| Comment  | Tags