Run electron-app with sudo privileges asking only once for password

Viewed 29

I'm building an electron-app where i need to run commands with superuser privileges, i don't want to ask the user for a password every time. How can i start the app, asking only for the password once. I tried:

sudo /path/to/electron --no-sandbox main.js

Unfortunately, i get this error:

enter image description here

I know there are libraries like https://www.npmjs.com/package/sudo-prompt, but i only want to ask once for permission. I run everything locally, so please don't tell me about the security risk of running browser as root.

0 Answers
Related