title: SSH command works in terminal, but fails with nodejs / ssh2
body: <p>In terminal if I login with ssh and run a command like <code>service something reload</code> it runs just fine, but when I execute the same command in a nodejs script with the ssh2 library (<code>.exec</code> function) it doesn't run and i get an error &quot;ash: command not found&quot;.</p>
  <p>Tried with <code>sudo service..</code> but it's same thing.</p>
  <p>Some commands do work tho, like <code>uptime</code> or <code>ifconfig</code>, but service doesn't and I need that one. The server to which I am connecting is a router that runs open wrt.</p>
  <hr />
  <p>this is the nodejs script:</p>
  <pre><code>const Client = require('ssh2').Client;
  const conn = new Client();
  
  conn.on('ready', async() =&gt; {
  
    conn.exec('service network reload', {
      env: {'PATH': '/usr/sbin:/usr/bin:/sbin:/bin'},
    }, (err, stream) =&gt; {
      if(err)
        return console.log(err);
  
      stream.on('close', () =&gt; console.log('ok'));
      stream.stderr.on('data', data =&gt; console.log(data.toString()));
    }); 
  
  }).connect({
    host: ROUTER_HOST,
    port: 22,
    username: 'root',
    password: '1234'
  });
  </code></pre>
  <p>A screenshot of the terminal output for <code>which</code>:</p>
  <p><a href="https://i.stack.imgur.com/hZtt1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hZtt1.png" alt="wtf" /></a></p>