clj-ssh icon indicating copy to clipboard operation
clj-ssh copied to clipboard

Use'ing clj-ssh.cli fails if known_hosts file does not exist

Open tatut opened this issue 10 years ago • 2 comments

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.

tatut avatar Jun 24 '14 11:06 tatut

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?

sirwobin avatar Aug 30 '16 12:08 sirwobin

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.

mdaley avatar Apr 21 '17 10:04 mdaley