Skip to content

Instantly share code, notes, and snippets.

@Licenser
Created November 13, 2009 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Licenser/74dff9294228f4300caa to your computer and use it in GitHub Desktop.
Save Licenser/74dff9294228f4300caa to your computer and use it in GitHub Desktop.
(def *config* (new java.util.Properties))
(.put *config* "StrictHostKeyChecking" "no")
(def *jsch* (new com.jcraft.jsch.JSch))
(def *session* (.getSession *jsch* "root" "192.168.197.45" 22))
(doto *session*
(.setConfig *config*)
(.setPassword "-")
(.connect))
(def *channel* (.openChannel *session* "exec"))
(doto *channel*
(.setCommand "ps -ef;date;hostname")
(.setInputStream nil)
(.setErrStream System/err))
(def *ssh-in* (.getInputStream *channel*))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment