SSH.runSshCommandKeys()

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.runSshCommandKeys({

hostName: '127.0.0.1',

port: '22',

userName: 'user1',

privatekey: '',

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'
privatekey required

The location of your private key on the local server. DO NOT enter the key its self as text!

''
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.'