Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non system agent not working? #26

Open
joachimdb opened this issue Jun 18, 2014 · 3 comments
Open

non system agent not working? #26

joachimdb opened this issue Jun 18, 2014 · 3 comments

Comments

@joachimdb
Copy link

Not sure if this is a bug or just something missing from the documentation, but when I do

(Let [agent (ssh-agent {})]
    (let [session (session agent domain {:strict-host-key-checking :no})]
      (with-connection session
        (let [result (ssh session {:cmd "ls"})]
          (println result)))))

things work fine, whereas when I do

(let [agent (ssh-agent {:use-system-ssh-agent false
                        :known-hosts-path "/Users/joachim/.ssh/known_hosts"})]
    (add-identity agent {:private-key-path "/Users/joachim/.ssh/id_rsa"
                         :public-key-path "/Users/joachim/.ssh/id_rsa.pub"})
    (let [session (session agent domain {:username "joachim" :strict-host-key-checking :no})]
      (with-connection session
        (let [result (ssh session {:cmd "ls"})]
          (println result)))))

I get

JSchException USERAUTH fail  com.jcraft.jsch.UserAuthPublicKey.start (UserAuthPublicKey.java:119)

(The private and public key paths provided are the same as used by the system ssh-agent)

@hugoduncan
Copy link
Collaborator

The other difference in your two cases is :strict-host-key-checking, and I'm not sure using the non system agent supports :known-hosts-path.

@joachimdb
Copy link
Author

Thanks for the reply Hugo, but I don't get why you say that both cases differ in :strict-host-key-checking, they both set it to :no? Furthermore, the ssh-agent function does take a :known-hosts-path, setting it to "~/.ssh/known_hosts" by default when not provided, irrespective of whether a system-agent is used or not?

Anyway, I can't get the non-system ssh-agent to work, not even when leaving out the strict-host-key-checking and/or the :known-hosts-path. Any ideas?

@peterhhchan
Copy link

JSchException USERAUTH fail typically means the password is incorrect. Does your key have a password? It might make sense that the version of your code using the system ssh-agent works since it can provide the key without prompting the user for the password.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants