Create user at VPN using node js function

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
rahul260792
Posts: 3
Joined: Thu Sep 06, 2018 6:56 am

Create user at VPN using node js function

Post by rahul260792 » Thu Nov 15, 2018 8:08 am

Earlier I was able to create user at my VPN hosted on a google cloud compute engine using the following function:

Code: Select all

var exec = require('child_process').exec;
  
  exec(
    " /user_code/vpncmd my-vpn-server.softether.net:443" +
    " /SERVER /ADMINHUB:VPN /PASSWORD:myPassword" +
    " /CSV /CMD UserCreate " + vpnName +
    " /GROUP:none /REAL NAME:none /NOTE:none", function callback(error, stdout, stderr) {
      if (error) {
        console.error(`failed to create vpn user: ${vpnName}`);
        console.error(`failure cause: ${error}`);
        console.log(`stderr: ${stderr}`);
        return res.send(error);
      }
      console.log(`vpn user ${vpnName} created stdout: ${stdout}`);
      console.log(`stderr: ${stderr}`);
      console.log('creating password...');
      exec("/user_code/vpncmd my-vpn-server.softether.net:443 /SERVER /ADMINHUB:VPN /PASSWORD:myPassword /CSV /CMD UserPasswordSet " + vpnName + " /PASSWORD:userPassword", function callback(error, stdout, stderr) {
        if (error) {
          console.error(`failed to set password vpn user: ${vpnName}`);
          console.error(`failure cause: ${error}`);
          console.log(`stderr: ${stderr}`);
          return res.send(error);
        }
        console.log(`vpn user ${vpnName} set password stdout: ${stdout}`);
        console.log(`stderr: ${stderr}`);
      });
      return res.send('User created');
    });
Now when I execute this function it returns me the following error:
Error: Command failed: /user_code/vpncmd my-vpn-server.softether.net:443 /SERVER /ADMINHUB:VPN /PASSWORD:myPassword /CSV /CMD UserCreate demo_man /GROUP:none /REAL NAME:none /NOTE:none
/bin/sh: 1: /user_code/vpncmd: Permission denied

Code: Select all

{
    "killed": false,
    "code": 126,
    "signal": null,
    "cmd": " /user_code/vpncmd my-vpn-server.net.softether.net:443 /SERVER /ADMINHUB:VPN /PASSWORD:myPassword /CSV /CMD UserCreate demo_man /GROUP:none /REAL NAME:none /NOTE:none"
}
Can anyone please guide where I am going as I haven't changed anything and it was working perfectly earlier.

Also if there is any other method to do the same please guide me. Thanks.!

Post Reply