A Clojure library for SSH support, API compatible with bbssh.
clojuressh is a port of the bbssh babashka pod into a native Clojure
library. A local installation of ssh is not required.
This library when loaded into babashka acts as a shim to the bbssh pod. Thus you can refer to this
in your bb-deps.edn and use it like you would in clojure, allowing you to write one codebase that
will run on both clojure and babashka. You can also refer to it in your clojure deps.edn or
project.clj and use it the same way.
io.epiccastle/clojuressh {:mvn/version "1.0.0"}
[io.epiccastle/clojuressh "1.0.0"]
Here is a simple example that connects over ssh, runs a command, and
disconnects, returning the standard output. Put this in src/testssh/core.clj:
(ns testssh.core
(:require [clojuressh.core :as clojuressh]
[clojuressh.session :as session]))
(defn -main []
(let [session (clojuressh/ssh "localhost")]
(-> (clojuressh/exec session "echo 'I am running remotely'" {:out :string})
deref
:out
prn)
(session/disconnect session)
(shutdown-agents)))
Make a deps.edn like:
{:paths ["src"]
:deps {org.clojure/clojure {:mvn/version "1.12.5"}
io.epiccastle/clojuressh {:mvn/version "1.0.0"}}}
Run your mainline with:
clj -M -m testssh.core
Using the same src/testssh/core.clj and deps.edn shown above, run your mainline with:
bb --config deps.edn -m testssh.core
Copyright 2026 (c) Crispin Wellington. All rights reserved.
The use and distribution terms for this software are covered by the
Eclipse Public License 2.0 which can be found in LICENSE.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |