Start application with root


#1

Is there a way to set it so that when electron starts on Mac that it requests to be run with root?

I am making a Desktop Application for my currently terminal only program and want to have a completely seamless experience for users with no terminal experience. My terminal application needs to bind to port 53, 80, and 443, which requires the application to usually be run with sudo.

So basically is there a way to start electron as sudo without going into the terminal on Mac?


#2

You could launch a subprocess to handle listening on those ports. That subprocess could be run via the sudo node package. This would also have the benefit of limiting how much of your code is running with elevated privileges.


#3

Are you meaning to launch a child process from within the node app?