ssh-exec

Execute a script over ssh using Node.JS

Github星跟踪图

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

主要指标

概览
名称与所有者mafintosh/ssh-exec
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2013-11-20 18:44:24
推送于2020-06-21 01:21:53
最后一次提交2016-01-29 08:10:08
发布数18
最新版本名称v2.0.0 (发布于 2016-01-20 20:53:37)
第一版名称v0.1.0 (发布于 2013-11-20 18:53:32)
用户参与
星数126
关注者数5
派生数25
提交数52
已启用问题?
问题数21
打开的问题数11
拉请求数3
打开的拉请求数3
关闭的拉请求数8
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?