2

I've added clj-ssh as a dependency to a Leiningen project, and I can (use 'clj-ssh.ssh) but calling (ssh-agent {}) gives the error

UnsatisfiedLinkError Unable to load library 'c': The specified module cannot be found.
at com.sun.jna.NativeLibrary.loadNativeLibrary
...
at org.jcraft.jsch.agentproxy.usocket.JNAUSocketFactory$CLibrary.(clinit)
...

Anyone know why this is? I'm thinking it could be to do with Windows not coming with a C standard library, in which case could installing e.g. cygwin help?

4

4 回答 4

1

Try installing cygwin and add something like:

-Djava.library.path=...path to lib dir ...

if it doesn't find the library on it's own.

于 2013-05-06T23:02:06.950 回答
1

I'm the author of jsch-agent-proxy, which has been used in clj-ssh.

I think it will not work for cygwin's ssh-agent, because JNA does not provide the native library for it. How about trying Putty's Pageant? If you need to use cygwin's ssh-agent and "nc" command exits on your cygwin environment, how about using NCUSocketFactory? I'm not so familiar with clj-ssh, but it will be possible to use NCUSocketFactroy instead of JNAUSocketFactory, according to agent.clj.

UPDATE: I have confirmed that I can successfully run clj-ssh with ssh-agent on my Cygwin environment by applying the following commit,

GitHub clj-ssh commit:f1109e2c0dfa25c9db563b2f64d2b7dcb4653adf

于 2013-05-07T10:13:49.360 回答
0

Ok, after some digging in the source it seems that clj-ssh attempts to use the system ssh-agent by default (which seems like strange behaviour if it isn't windows compatible). This makes clj-ssh.cli unusable but clj-ssh.ssh is fine with the fix

(ssh-agent {:use-system-ssh-agent false})

If you do want to use a system ssh-agent, the readme for clj-ssh and ymnk below mention PuTTY's pageant, I couldn't find any info on setting this up but it should be doable with cygwin.

于 2013-05-08T20:30:36.087 回答
0

I've seen this if the SSH_AUTH_SOCK environment variable is set. Clearing this environment variable before starting the jvm might solve the issue.

When SSH_AUTH_SOCK is not set, clj-ssh should automatically use pageant if it is running.

Looks like the best solution would be to support NCUSocketFactory as per ymnk's commit, and add documentation about cygwin's ssh-agent. Happy to take a pull request for that.

于 2013-05-15T03:41:49.270 回答