Skip to content

star-collector/ssh-executor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ssh-executor

Simple ssh executor for Node.js written in C++ using libssh2. Returns terminal output after successful command execution. Currently works on Linux only.

Installation

You need to have libssh2 installed on your computer:

$ sudo apt-get install libssh2-1-dev

Also, make sure Node-gyp module is installed (in order to compile C++ code into a Node addon):

$ npm install -g node-gyp

Then you can proceed with npm installation:

$ npm install ssh-executor

Usage

const ssh = require('ssh-executor');

ssh.connect({ // Establish connection
	host: "127.0.0.1",
	port: '22',
	username: "yourusername",
	password: 'yourpassword'
}, (err) => {
	if(!err) {
		console.log('Successfully connected!');
	}
});

ssh.exec('echo NOBODY EXPECTS THE SPANISH INQUISITION!', (result, err) => {
	if(!err) {
		console.log(result); //NOBODY EXPECTS THE SPANISH INQUISITION!
	}
}); // Execute your command

ssh.close(); // Close your SSH connection.

About

SSH command executor for Node.js written in C++ using libssh2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published