{"id":17480016,"url":"https://github.com/dacr/jassh","last_synced_at":"2025-04-06T06:09:00.029Z","repository":{"id":14437140,"uuid":"17148534","full_name":"dacr/jassh","owner":"dacr","description":"High level scala SSH API for easy and fast operations on remote servers.","archived":false,"fork":false,"pushed_at":"2024-10-06T10:08:17.000Z","size":331,"stargazers_count":72,"open_issues_count":4,"forks_count":25,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-30T05:08:53.903Z","etag":null,"topics":["dsl","jsch","scala","scala-ssh","scala-ssh-library","ssh","ssh-client"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"martndemus/ember-font-awesome","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dacr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-24T19:51:55.000Z","updated_at":"2025-03-17T23:00:13.000Z","dependencies_parsed_at":"2023-11-18T00:08:55.602Z","dependency_job_id":"bdbf3584-aec6-46fc-be68-fb75e48f123c","html_url":"https://github.com/dacr/jassh","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacr%2Fjassh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacr%2Fjassh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacr%2Fjassh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacr%2Fjassh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dacr","download_url":"https://codeload.github.com/dacr/jassh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441052,"owners_count":20939239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsl","jsch","scala","scala-ssh","scala-ssh-library","ssh","ssh-client"],"created_at":"2024-10-18T21:42:25.752Z","updated_at":"2025-04-06T06:09:00.011Z","avatar_url":"https://github.com/dacr.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JASSH - the SCALA SSH API  [![Build Status][travisImg]][travisLink] [![License][licenseImg]][licenseLink] [![Maven][mavenImg]][mavenLink] [![Scaladex][scaladexImg]][scaladexLink]\n\nHigh level scala SSH API for easy and fast operations on remote servers.\n\nThis API is [JSCH](https://github.com/mwiede/jsch) based. Interfaces are stable. Many helper functions are provided to simplify unix operations [ps, ls, cat, kill, find, ...](https://javadoc.io/doc/fr.janalyse/janalyse-ssh_3/latest/api/fr/janalyse/ssh/AllOperations.html), an other goal of this API is to create an unix abstraction layer (Linux, Aix, Solaris, Darwin, ...).\n\nOne of the main difference of this API with others is that it can work with **persisted shell sessions**. Many commands can then be sent\nto an already running and **initialized** shell session ! Thanks to this feature you can greatly speed up your SSH shell performances,\nfrom 70 cmd/s to more than 500 cmd/s ! There is no differences in API between persisted and not persisted shell sessions, that's the\nreason why the API looks very simple from scala point of view; when you execute a command in a shell persisted session you get directly\nthe output of the command but not the return code. The return code will be accessible only indirectly using for example a \"echo $?\" command.\n\nThe current release doesn't provide full shell interaction with executed commands, you only send a command and get the result, but\nI'm currently working to provide full interactivity, to allow interaction with commands such as to provide data after the command is\nstarted (send a password once the prompt is visible, ...). This work is currently visible through SSHReact class and SSHReactTest\ntest class.  \n\nIn your build.sbt, add this (available in maven central) :\n```\nlibraryDependencies += \"fr.janalyse\"   %% \"janalyse-ssh\" % version\n```\nLatest `version`: [![Maven][mavenImg]][mavenLink] [![Scaladex][scaladexImg]][scaladexLink]\n\n\n[**Scala docs**](https://javadoc.io/doc/fr.janalyse/janalyse-ssh_3)\n\n\n[mavenImg]: https://img.shields.io/maven-central/v/fr.janalyse/janalyse-ssh_3.svg\n[mavenImg2]: https://maven-badges.herokuapp.com/maven-central/fr.janalyse/janalyse-ssh_3/badge.svg\n[mavenLink]: https://search.maven.org/#search%7Cga%7C1%7Cfr.janalyse.janalyse-ssh\n\n[scaladexImg]: https://index.scala-lang.org/dacr/jassh/janalyse-ssh/latest.svg\n[scaladexLink]: https://index.scala-lang.org/dacr/jassh\n\n[licenseImg]: https://img.shields.io/github/license/dacr/jassh.svg\n[licenseImg2]: https://img.shields.io/:license-apache2-blue.svg\n[licenseLink]: LICENSE\n\n[codacyImg]: https://img.shields.io/codacy/a335d839f49646389d88d02c01e0d6f6.svg\n[codacyImg2]: https://api.codacy.com/project/badge/grade/a335d839f49646389d88d02c01e0d6f6\n[codacyLink]: https://www.codacy.com/app/dacr/jassh/dashboard\n\n[codecovImg]: https://img.shields.io/codecov/c/github/dacr/jassh/master.svg\n[codecovImg2]: https://codecov.io/github/dacr/jassh/coverage.svg?branch=master\n[codecovLink]: http://codecov.io/github/dacr/jassh?branch=master\n\n[travisImg]: https://img.shields.io/travis/dacr/jassh.svg\n[travisImg2]: https://travis-ci.org/dacr/jassh.png?branch=master\n[travisLink]:https://travis-ci.org/dacr/jassh\n\n\n----\n\n## hello world script\n\nIt requires a local user named \"test\" with password \"testtest\",\nremember that you can remove the password, if your public key has\nbeen added in authorized_keys file of the test user.\n\n```scala\n// ---------------------\n//\u003e using scala \"3.3.1\"\n//\u003e using dep \"fr.janalyse::janalyse-ssh:1.1.0\"\n//\u003e using lib \"org.slf4j:slf4j-nop:2.0.9\"\n// ---------------------\n\njassh.SSH.once(\"127.0.0.1\", \"test\", \"testtest\") { ssh =\u003e\n  println(ssh.execute(\"\"\"echo \"Hello World from $(hostname)\" \"\"\"))\n}\n```\n\n## Persisted shell session\n\n```scala\n// ---------------------\n//\u003e using scala  \"3.3.1\"\n//\u003e using dep \"fr.janalyse::janalyse-ssh:1.1.0\"\n//\u003e using lib \"org.slf4j:slf4j-nop:2.0.9\"\n// ---------------------\n\njassh.SSH.shell(\"localhost\", \"test\") { sh =\u003e\n  import sh.*\n  println(s\"initial directory is $pwd\")\n  cd(\"/tmp\")\n  println(s\"now it is $pwd\")\n  println(echo(\"Hello world !\"))\n}\n```\n\n## Shell session to an SSH enabled  PowerShell Server (windows)\nThis functions much the same as a regular SSH connection, but many of the unix like commands are not supported and the terminal behaves differently\n```scala\nimport fr.janalyse.ssh._\n\nval settings = SSHOptions(host = host, username=user, password = pass, prompt = Some(prompt), timeout = timeout)\nval session = SSH(settings)\n\nval shell = session.newPowerShell\n\nprintln(shell.ls)\nprintln(shell.pwd)\n```\n\n## SSH Configuration notes\n\nTo turn on/off ssh root direct access or sftp ssh subsystem.\n```\n    Subsystem       sftp    ...     (add or remove comment)\n    PermitRootLogin yes or no       (of course take care of security constraints)\n```\n\nAIX SSHD CONFIGURATION :\n```\n    vi /system/products/openssh/conf/sshd_config\n    /etc/rc.d/rc2.d/S99sshd reload\n```\n\nLINUX SSHD CONFIGURATION\n```\n    vi /etc/ssh/sshd_config\n    /etc/init.d/sshd reload\n```\n\nSOLARIS SSHD CONFIGURATION\n```\n    vi /usr/local/etc/ssh/sshd_config\n    svcadm restart ssh\n```\n\nMAC OS X CONFIGURATION\n```\n    sudo vi /etc/sshd_config\n    sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdacr%2Fjassh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdacr%2Fjassh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdacr%2Fjassh/lists"}