Comments (17)
Thanks, I think this is a duplicate of #39
Please see the suggestion there.
from sudo-prompt.
@jorangreef Thanks for fast reply, I have seen that issue, but in my case, I have to run the commands in different stages of the application execution, I mean that they are not in a row.
from sudo-prompt.
Thanks @mahdifani14, it's not possible. Not because of sudo-prompt, but because sudo itself on Linux and Mac uses TTY tickets. Each time sudo-prompt runs it's essentially running in a new TTY (a new child process), so sudo itself thinks it needs to prompt for a password again. If the user does not have TTY tickets enabled for sudo, then sudo-prompt will only prompt the first time.
from sudo-prompt.
@jorangreef
I got it.
I'll check other possibilities to overcome this obstacle.
Anyway, thanks again for your support.
from sudo-prompt.
It's a pleasure, thanks for checking. You could try using sudo-prompt to launch a long-lived process with root privileges which you could then use to launch your commands as and when needed. If there is another way please let me know.
from sudo-prompt.
@jorangreef Grateful for the hint, I'll try it and inform you about the result or any other solution if I found.
from sudo-prompt.
@jorangreef Eventually after a long ride over this issue, I found a solution and decided to share it with you maybe would be useful. Actually, I tried the idea that you stated but, it didn't work due to the Electron and NodeJs limitations and it's not possible to run the whole app using sudo-prompt.
Therefore, after lots of researches, I divided the story into two scenarios w.r.t the platforms Windows and OSX/Linux.
For the first case, I'm using mt.exe as one of the Windows SDK through which I can force the user to accept the application run as Administrator; for more info, check this link: http://layer0.authentise.com/electron-and-uac-on-windows.html
For latter one, I'm using a mixture of the original sudo and sudo-prompt which is working fine through command line but, the graphical functionality is still under construction and whenever I finalized it, I'll let you know.
from sudo-prompt.
Thanks for the link @mahdifani14, that's really helpful.
from sudo-prompt.
@jorangreef You're welcome.
Mac OSX has been tested by sudo-prompt and worked fine. After running the first command, it keeps the session and uses for the others so, the prompt just appears once.
However, for Linux case, I have to execute the application by using 'gksudo' in the terminal (Electron runs the application by executing a command in terminal "start": "gksudo node_modules/.bin/electron ."
) that's why I cannot use sudo-prompt for this matter.
from sudo-prompt.
Have you tested macOS Sierra? There was a change recently so that macOS Sierra has started using TTY tickets. macOS Sierra should require a password for each separate sudo-prompt call.
from sudo-prompt.
@jorangreef Good question, no I didn't. I'll check it and let you know because my application must be cross-platform.
Grateful for the point,
from sudo-prompt.
@mahdifani14 @jorangreef have you found any solution yet?
am new to this electron. I needed to open specific .app file from mac application. so i tried to run "open path/to/the/application.app" it was showing some error. so i used this library and run the same command now it's working. but the only problem is it's showing the password prompt for every exec. is there is any way to ask that only one time? Thank you.
from sudo-prompt.
@Muneefm I finally used Cocoasudo, it works fine for all OSX versions, check the link below:
http://www.performantdesign.com/2009/10/26/cocoasudo-a-graphical-cocoa-based-alternative-to-sudo/
from sudo-prompt.
@Muneefm TTY tickets are now the default on macOS Sierra onwards.
Each shell session must authenticate as sudo, independently of existing sudo sessions.
You can think of sudo-prompt as launching the equivalent of an authenticated shell session, which is why each session requires a password.
You can either batch up your commands, or disable TTY tickets.
from sudo-prompt.
@mahdifani14 How did you use cocoasudo with Electron?
from sudo-prompt.
@jorangreef You're welcome.
Mac OSX has been tested by sudo-prompt and worked fine. After running the first command, it keeps the session and uses for the others so, the prompt just appears once.
However, for Linux case, I have to execute the application by using 'gksudo' in the terminal (Electron runs the application by executing a command in terminal"start": "gksudo node_modules/.bin/electron ."
) that's why I cannot use sudo-prompt for this matter.
can u explain it in detail for Linux. Thank you.
from sudo-prompt.
Did anyone find a solution to this? It would be really helpful. Personally I am interested on a solution for macOS.
from sudo-prompt.
Related Issues (20)
- 'Command failed' in Electron app HOT 1
- Not possible in Mac App Store, aka app-sandbox HOT 5
- macOS Catalina Operation not permitted HOT 1
- OS dialog prompt is not being prompted in Windows 10 HOT 1
- Operation not permitted in macOS with sudo-prompt
- Prompt shows but name and icon are not visible on macOS HOT 8
- "User did not grant permissions" if I click "Yes" too quickly on Windows? HOT 1
- `sudo-prompt` fails to detect `pkexec` or `kdesudo` in "strictly" confined snap
- Special characters handling on Linux
- Strange behaviour with Electron 9 on Win10 HOT 1
- in Eelectron app Rendering process, sudo run cp not work
- Hello, why option.name just support [a-z0-9 ] ?
- How to get elevated shell and run a command without sudo prefix HOT 1
- macOS: Application cannot be opened because the developer cannot be verified
- BigSur 11.1 issue: The authorization was denied since no user interaction was possible HOT 1
- Linux: option.env not used
- Unexpected behaviour with linux - electron.js HOT 1
- electron exe with root system privileges in linux, It's possible to do ?
- How to run multiple commands without requiring password every time HOT 6
- Any pkg similar to this, but without root/admin?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sudo-prompt.