How to run electron app as sudo/root user?
See original GitHub issueIn my npm start script I have sudo electron .
but after running the packager the app does not start with sudo privileges. Can someone point me in the right direction for starting electron app as sudo user?
Some of my npm modules require sudo access for them to work
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (5 by maintainers)
Top Results From Across the Web
Run node commands as root in electron app - Stack Overflow
You can use https://github.com/jorangreef/sudo-prompt to exec a command using sudo and show a graphical OS password prompt. You can use sudo- ...
Read more >electron-sudo - npm
Start using electron-sudo in your project by running `npm i electron-sudo`. There are 2 other projects in the npm registry using ...
Read more >A brand new website interface for an even better experience!
How to run electron app as sudo /root user?
Read more >Fixing a baffling issue when running Electron as root in GNU ...
Why access denied? We're running the application as the superuser, who presumably has access to everything, and we don't get the error when ......
Read more >Sudo | npm.io
is-root. Check if the process is running as root user, for example, one started with `sudo`. sudorootuserpermissionsuidprocessposix ; sudo-prompt. Run a command ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@miguelmota I am the author of
sudo-prompt
, which uses essentially the sameosascript
(but with support forstatus code
,stdout
,stderr
and an application icon in the Mac prompt) as well as cross-platform support. How couldsudo-prompt
be improved to work better for you?I do not endorse the idea of starting an Electron app as root. Starting up a web browser engine with administrator access is a large security risk. What you should do instead is run it as an unprivileged user, and then use a module like
sudo-prompt
to call the app again with a Node script that contains all the logic that requires superuser privileges, but with theELECTRON_RUN_AS_NODE
variable set in the child environment.