New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@xch/node-remote-exec

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xch/node-remote-exec

Execute shell commands on remote machine through ssh for nodejs.

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

Execute Shell Commands on Remote Server

Install

npm install @xch/node-remote-exec

Quick Example

const execSync = require('@xch/node-remote-exec');

const execResult = execSync('some-server', [
  'echo "Hello World!"',
  'ls -al',
  'exit 1'
]);

Equivalent to:

$ ssh root@some-server 'echo "Hello World!" && \
ls -al && \
exit 1'

Complete Example

const execSync = require('@xch/node-remote-exec');

const execResult = execSync({
  host: 'some-server',
  user: 'some-user'
}, [
  'echo "Hello World!"',
  'ls -al',
  'exit 1'
], {
  cwd: '/path/of/local/work/directory',
  log: '/path/of/local/log/file',
  remoteCwd: '/path/of/remote/work/directory',
  remoteLog: '/path/of/remote/log/file',
  stdout: true // Print commands to stdout.
});

Equivalent to:

$ ( ssh some-user@some-server '( cd '\''/path/of/remote/work/directory'\'' && \
echo "Hello World!" && \
ls -al && \
exit 1 ) \
| tee -a '\''/path/of/remote/log/file'\'' ; test ${PIPESTATUS[0]} -eq 0' ) \
| tee -a '/path/of/local/log/file' ; test ${PIPESTATUS[0]} -eq 0

Keywords

Node

FAQs

Package last updated on 03 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts