clj-ssh
clj-ssh copied to clipboard
Use'ing clj-ssh.cli fails if known_hosts file does not exist
user=> (use 'clj-ssh.cli)
CompilerException com.jcraft.jsch.JSchException: java.io.FileNotFoundException: C:\Users\Tatu.ssh\known_hosts (The system cannot find the file specified), compiling:(cli.clj:39:15)
Creating an empty known_hosts fixes the issue.
Amazing that this issue is 2 years old. I'm running a process in AWS lambda where I don't have control over known_hosts. Is any fix planned?
clj-ssh is currently using com.jcraft.jsch version 0.1.53. If you look in the code for the latest version of com.jcraft.jsch (0.1.54), you'll see that, in KnownHosts.java, the setKnownHosts method has been changed to have an empty catch for FileNotFoundException. In 0.1.53 there was throw new JschException...
. So, now, it doesn't matter if the known_hosts file isn't present initially.
So the answer for me was to exclude com.jcraft/jsch from clj-ssh and specifically include the latest version 0.1.54.