ssh-exec

Execute a script over ssh using Node.JS

Github stars Tracking Chart

ssh-exec

Execute a script over ssh using Node.JS and pipe to and from it

It is available through npm

npm install ssh-exec

It is written in plain Javascript and uses ssh2 for all the heavy lifting.

Usage

var exec = require('ssh-exec')

// using ~/.ssh/id_rsa as the private key

exec('ls -lh', 'ubuntu@my-remote.com').pipe(process.stdout)

// or using the more settings

exec('ls -lh', {
  user: 'ubuntu',
  host: 'my-remote.com',
  key: myKeyFileOrBuffer,
  password: 'my-user-password'
}).pipe(process.stdout)

// or if you want to pipe some data to the remote process

process.stdin
  .pipe(exec('echo try typing something; cat -', 'ubuntu@my-remote.com'))
  .pipe(process.stdout)

Optionally there is a callback api as well

exec('ls -lh', 'ubuntu@my-remote.com', function (err, stdout, stderr) {
  console.log(err, stdout, stderr)
})

License

MIT

Main metrics

Overview
Name With Ownermafintosh/ssh-exec
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2013-11-20 10:44:24
Pushed At2020-06-20 17:21:53
Last Commit At2016-01-29 01:10:08
Release Count18
Last Release Namev2.0.0 (Posted on 2016-01-20 13:53:37)
First Release Namev0.1.0 (Posted on 2013-11-20 11:53:32)
用户参与
Stargazers Count126
Watchers Count6
Fork Count25
Commits Count52
Has Issues Enabled
Issues Count21
Issue Open Count11
Pull Requests Count3
Pull Requests Open Count3
Pull Requests Close Count8
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private