gksudo

Packaging multiple scripts in PyInstaller

夙愿已清 提交于 2020-01-21 05:12:08
问题 I'm using PyInstaller to turn two scripts into one executable file, one of which calls the other. The issue I'm having is I can't figure out how to bundle the two scripts and still let them reference each other: The code that causes the issue is that one script, script1.py contains: subprocess.call(['gksudo','python script2.py']) This works fine when I run the scripts normally, but once they're packaged in PyInstaller I don't know how to make the call work. 回答1: I'm don't think pyinstaller

Is there any graphical “sudo” for Mac OS X?

余生颓废 提交于 2020-01-09 06:48:50
问题 I'm designing a little software in Java. I don't know the term/definition to what I'm doing, but I'm prompting commands from Java to the terminal. Something like this: Process process = Runtime.getRuntime().exec("command"); I've done this before in Linux, and I used gksudo for commands that required the root password. Is there any gksudo in OS X? Any graphical popup asking for root password? 回答1: You can more ore less manage to write your own with an AppleScript shell script: #!/bin/sh

Prompt user for password with dialog window when using sudo

筅森魡賤 提交于 2019-12-02 08:51:19
问题 I need to execute a command with sudo and want to display a dialog window for the user to enter their credentials. Attempts to customize a prompt with Applescript have been nothing short of excruciating and using the built in "do shell script with with administrator privileges" doesn't allow for customizing the window so the user knows where the request is coming from. Surely, there is a way to display a window, have the user enter their credentials and send the values back to sudo to execute

How do I sudo the current process?

蹲街弑〆低调 提交于 2019-12-01 03:56:17
Is it possible to use a sudo frontend (like gksudo) to elevate the privileges of the current process? I know I can do the following: sudo cat /etc/passwd- But I'm interested in doing this: sudo-become-root # magic function/command cat /etc/passwd- I'm writing in Python. My usecase is that I have a program that runs as the user, but may encounter files to read/write that are root-owned. I'd like to prompt for password, gain root privileges, do what I need, and then optionally drop privileges again. I know I could separate admin logic and non-admin logic into separate processes, and then just

How do I sudo the current process?

房东的猫 提交于 2019-12-01 01:07:30
问题 Is it possible to use a sudo frontend (like gksudo) to elevate the privileges of the current process? I know I can do the following: sudo cat /etc/passwd- But I'm interested in doing this: sudo-become-root # magic function/command cat /etc/passwd- I'm writing in Python. My usecase is that I have a program that runs as the user, but may encounter files to read/write that are root-owned. I'd like to prompt for password, gain root privileges, do what I need, and then optionally drop privileges

How to gain root privileges in python via a graphical sudo?

断了今生、忘了曾经 提交于 2019-11-30 15:41:01
问题 Part of my python program needs administrator access. How can I gain root privileges using a GUI popup similar to the gksudo command? I only need root privileges for a small part of my program so it would be preferable to only have the privileges for a particular function. I'm hoping to be able to do something like: gksudo(my_func, 'description of why password is needed') 回答1: You have two options here: You will need to make the part of the program that requires root privileges a separate