Clojure SSH Library, wrapping the jsch pure Java SSH implementation
License
Licenser/Clossher
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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 heinz@licenser.net. 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"))))
About
Clojure SSH Library, wrapping the jsch pure Java SSH implementation
Resources
License
Code of conduct
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published