Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Ssh = require('node-ssh');
- async function main() {
- const ssh = new Ssh();
- const sshPassword = 'SSH_PASSWORD';
- // connect
- await ssh.connect({
- host: 'SSH_HOST_ADDRESS',
- port: SSH_PORT,
- username: 'SSH_USER_NAME',
- password: sshPassword
- });
- // execute command
- res = await ssh.execCommand('ls -al', {options: {pty: true}});
- console.log(res);
- // disconnect
- ssh.dispose();
- }
- main();
Add Comment
Please, Sign In to add comment