SSH2
SSH2 gives you a secure way to access a computer over an unsecured network. This integration provides ssh2 with callback functions

Official Websitehttps://github.com/mscdex/ssh2
Documentationhttps://github.com/mscdex/ssh2
NodeJS packagehttps://www.npmjs.com/package/ssh2
Version1.11.0
Source Codehttps://github.com/mscdex/ssh2
Tagsshell
Network Connection needs
This integration needs network access to the server where the service is running.
See the Network access page for details about how to achieve that.
Credential configuration
To configure this credential you need the host
, port
and username
to connect to SSH server.
Then you'll need a password
or the private key
depending on how you want to connect.
Here you have an example of a filled credential configuration form in YepCode:

SSH2 snippets available in editor
note
The title is the triggering text for YepCode to autocomplete the script
Integration
New integration from credential
const sshConnection = yepcode.integration.ssh2("credential-slug");
New integration from plain authentication data (username and password)
const { Client } = require("ssh2");
const options = {
host: "hostname",
port: portNumber,
username: "username",
password: "password",
};
const sshConnection = new Client().connect(options);
New integration from plain authentication data (private key)
const { Client } = require("ssh2");
const options = {
host: "hostname",
port: portNumber,
username: "username",
privateKey: "privateKey",
};
const sshConnection = new Client().connect(options);
Interactive shell session
Shell session
sshConnection.on('ready', () => {
console.log('Client :: ready');
sshConnection.shell((err, stream) => {
if (err) {
throw err;
}
stream.on('close', () => {
console.log('Stream :: close');
sshConnection.end();
}).on('data', (data) => {
console.log('OUTPUT: ' + data);
});
stream.end("your-command-here\nexit\n");
});
})