Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/licenser/clossher
Clojure SSH Library, wrapping the jsch pure Java SSH implementation
https://github.com/licenser/clossher
Last synced: 25 days ago
JSON representation
Clojure SSH Library, wrapping the jsch pure Java SSH implementation
- Host: GitHub
- URL: https://github.com/licenser/clossher
- Owner: Licenser
- License: mit
- Created: 2009-11-20T09:31:37.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2012-08-02T11:05:03.000Z (over 12 years ago)
- Last Synced: 2024-07-10T16:56:33.885Z (4 months ago)
- Language: Clojure
- Homepage:
- Size: 125 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
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
interaction).== 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: http://www.jcraft.com/jsch/. 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
[email protected].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"
(with-sftp
(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 'net.licenser.ssh.shell)(with-session "user" "pass" "host"
(with-shell
(println (shell-read-all))
(println (shell-exec "exec bash"))
(println (shell-exec "export PS1=\"\\h:\\w# \""))
(println (shell-exec "ls"))))