SSH.runSshCommand()

Run a command on a remote server via SSH. Requires Host, Username, Password and ommand.

Usage

Hover over inputs/exits for more info.

var SSH = require('machinepack-ssh');


// Run a command on a remote server via SSH. Requires Host, Username, Password and ommand.

SSH.runSshCommand({

hostName: '127.0.0.1',

port: '22',

userName: 'user1',

password: '',

command: 'mkdir testfolder',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

hostName required

The hostname or IP of the server you would like to SSH into. Do not include the port.

'127.0.0.1'
port required

The port you wish to connect through on the remote server. This is usually 22 by default.

'22'
userName required

The username of the account you would like to SSH into the remote server with.

'user1'
password required

The password for your user account on the remote server.

''
command required

The command you wish to execute on the remote machine. For SFTP transfers, use the SFTP function.

'mkdir testfolder'

Exits

error

An unexpected error occurred.

success

OK.

'Connection Successful.'