clj-commons / clj-commons/clj-ssh
ClassCastException com.jcraft.jsch.Session cannot be cast to java.lang.String clj-ssh.ssh/session-impl
- Dominant language
- Clojure
- Stars
- 241
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
I try to run command on remote machine, I success to connect through my MAC over ssh without password (use `known_host`)
so I run through `REPL`:
```
(let [agent (clj-ssh.ssh/ssh-agent {})]
(clj-ssh.ssh/add-identity agent {
:known-hosts-path "/Users/maxim/.ssh/known_hosts"
:private-key-path "/Users/maxim/.ssh/id_rsa"
:public-key-path "/Users/maxim/.ssh/id_rsa.pub"
})
(let [session (clj-ssh.ssh/session agent "ops-ev19.comp.com" {:username "maxim" :strict-host-key-checking :no})]
(clj-ssh.ssh/with-connection session
(let [result (ssh session {:cmd "ls"})]
(println (:out result))))))
```
and get error:
`ClassCastException com.jcraft.jsch.Session cannot be cast to java.lang.String clj-ssh.ssh/session-impl (ssh.clj:318)`
---
I use `[clj-ssh "0.5.14"]`
Any ideas?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at session-impl in ssh.clj:318 and reproduce the reported REPL example with clj-ssh 0.5.14. Trace why the com.jcraft.jsch.Session value is treated as a String; done means the connection succeeds without a ClassCastException and the remote ls output is printed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100