-
Notifications
You must be signed in to change notification settings - Fork 119
How to run multiple commands without requiring password every time #141
Comments
I have same problem,Looking forward to a reply |
@nobody-sun It looks like we won't be getting an answer here. I found a workaround that might work depending on your needs. Instead of running multiple commands, you can concatenate your commands into a string separating them with && and do a single call to sudo-prompt. This will allow you to call multiple commands and entering a single password. This helps if all the stuff you need to do can be done with OS commands. If you need run separate commands at different points in your app, then this approach won't help. I'm still looking for alternatives. If I find any I'll post here again. I also tried another library, electron-sudo. That one did not work at all for me. |
I think that we should use sudo to create launchd job, it can help once sudo dialog for multiple commands. |
I have same problem,Looking forward to a reply |
@Awn-Alice Your best bet at this point is to concatenate your commands using && and running them all at once. For me this required refactoring some operations done in code, to doing them in bash commands. It it not a pretty solution, but it worked for what I was doing. Creating a launchd job sounds like an option, but it can be tricky to use, and its behavior can change on future Mac OS releases. |
@tutiplain Thank you for your reply, but this scheme may not be suitable for my situation. I may need to modify hosts file frequently. However, every time I change it, I have to enter the password |
Hi! I just began using sudo-prompt and while it works for me, I find it has the drawback of asking me for the password for every single command I run with it. Is there a way to get it to remember the password?
The text was updated successfully, but these errors were encountered: