question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to run electron app as sudo/root user?

See original GitHub issue

In 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:closed
  • Created 6 years ago
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
jorangreefcommented, Aug 25, 2017

@miguelmota I am the author of sudo-prompt, which uses essentially the same osascript (but with support for status code, stdout, stderr and an application icon in the Mac prompt) as well as cross-platform support. How could sudo-prompt be improved to work better for you?

6reactions
maleptcommented, May 7, 2017

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 the ELECTRON_RUN_AS_NODE variable set in the child environment.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found