I need help executing ssh commands in nodejs (vanilla javascript)

This page summarizes the projects mentioned and recommended in the original post on /r/learnjavascript

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • webssh

    :seedling: Web based ssh client

  • I am creating a web application where i want to open ssh terminal (https://github.com/huashengdun/webssh) with an event listener on frontend and spawn() method in backend nodejs. I built an api to trigger that command from front-end but the problem is that the it's returning stderr which is fine but how can i handle that in my frontend as i want to show the terminal in but my api is not giving any response. Is there any other way to make this script.

    This is my nodejs file where i am passing data from axios and executing the wssh command to start the webssh.

    const child = spawn('wssh', [\${body.cert_option}`, `${body.key_option}`, `--log-file-prefix=/var/www/html/myPanel/logs/terminal.log`]); child.stdout.on('data', (data) => { console.log(`stdout: ${data}`); return res.status(500).json({ success: 0, data: data }); }) child.stderr.on('data', (data) => { console.log(`stderr: ${data}`); return res.status(200).json({ success: 1, data: data }); }); child.on('error', (error) => { console.log(`error: ${error}`); return res.status(500).json({ success: 0, message: "SSH connection error", error: error }); }); child.on('exit', (code, signal) => { if (code) { console.log(`child process exited with code ${code}`); } if (signal) { console.log(`child process exited with signal ${signal}`); } }); });`

    PS: my project is not completely on nodejs, only the api.

    So here is something i want to create like this (source: aapanel):

    https://preview.redd.it/203hx6mzpy791.png?width=1349&format=png&auto=webp&s=d5cbbf22fe0d4cf4e6b7566d45f8d1957798ba8a

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts