Clojure SSH Library, wrapping the jsch pure Java SSH implementation
Latest commit bb9059f Jul 31, 2011 some updates


Clojure wrapper for the jsch SSH Library.

For the legal stuff please see LICENSE.

== What does it do ==

Clossher is a wrapper for the jsch SSH library, it allows to used most of the
SSH functions. It can execute code on a remote host, copy files forth and back
or open shell sessions - to allow executing multiple commands in a session that
'remember' their state (usefull for using su or things that require

== Nice to know ==

Since the underlaying jsch library is native java code clossher will work
entirely platform indipendant.

== Requirements ==

You will need the jsch jar file, currently this is tested with version 0.1.42.
The jar file can be fetched from: Most of the
credit should go there, the wrapper just makes it nice and clojureish, trying to
hide most of the javaness in the SSH stuff.

== Known issues ==

* Using exec after working with a shell-session does not work well.
* sftp does not work with directories, sorry it seems to be a limitation of the
  underlaying library, but I'm thinking about a workaround.

== Last words ==

If you've any questions, requests, suggestions feel free to drop me a mail at

Also I'd like to thank the #clojure channel, who always proved to be a very good
source for help, espcially _ato for a example how to best deal with sessions.

== Examples ==

This example shows how to use the sftp commands, connect to a host move around
the directory structure, execute commands and trainfair files.

  (use 'net.licenser.ssh)
  (use 'net.licenser.ssh.sftp)
  (with-session "user" "pass" "host"
      (sftp-lcd "D:/test")
      (sftp-cd "/tmp")
      (sftp-put "2.txt")
      (println (sftp-pwd))
      (println (sftp-lpwd))
      (sftp-exec "echo `hostname` > 2.txt")
      (sftp-lcd "D:/")
      (println (sftp-pwd))
      (println (sftp-lpwd))
      (sftp-get "/tmp/2.txt")))

This example demostrates how the shell works, that the shell keeps 'track' of
what happend.

  (use 'net.licenser.ssh)
  (use '

  (with-session "user" "pass" "host"
      (println (shell-read-all))
      (println (shell-exec "exec bash"))
      (println (shell-exec "export PS1=\"\\h:\\w# \""))
      (println (shell-exec "ls"))))