title: ssh into a server using js and to initiate a shell-
body: <p>I am trying to ssh to a linux machine using java script. I am able to connect to the server initaite a shell and run commands but I wanted to stay on the server where I ssh , I wanted it like a normal ssh which returns a shell.</p>
  <p>With the below script , it connects to the server and runs the command I give. But then it returns to the next line and does nothing . Just blank. Please help.</p>
  <pre><code>const { readFileSync } = require('fs');
  
  const { Client } = require('ssh2');
  
  const conn = new Client();
  conn.on('ready', () =&gt; {
    console.log('Client :: ready');
    conn.shell((err, stream) =&gt; {
      if (err) throw err;
      stream.on('close', () =&gt; {
        console.log('Stream :: close');
        conn.end();
      }).on('data', (data) =&gt; {
        console.log('OUTPUT: ' + data);
      });
      // stream.end('')
    });
  }).connect({
      host: '',
      port: 22,
      username: 'abilash',
      privateKey: readFileSync('/my/file')
    });
  </code></pre>
  <p>Pls help!!!</p>