I'm currently a small terminal based application in NodeJS and compiling with EncloseJS. My application is going to require elevated privileges on both Windows and OSX in order to work, how can I accomplish this with Node? I haven't been able to find anything that gave me a start.
Thanks,
For Windows there's node-windows package that offers UAC control.
In OS X the standard way for command-line tools is not to ask for permissions. Tools only use permissions they're given (sometimes implicitly via the dangerous setuid flag), and if that's not enough, they fail and ask be run with sudo.
If your tool only needs to permissions briefly (e.g. to open a port or a secret file), then you can require it to be started with sudo and then drop privileges using process.setuid/setgid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With