Run Python script with root privileges (not from terminal)

16,678

Take a look at http://www.cyberciti.biz/open-source/command-line-hacks/linux-run-command-as-different-user/ then just write a sh script which you chmod +x so that you can execute it then just use the script to launch the other script.

Share:
16,678

Related videos on Youtube

TellMeWhy
Author by

TellMeWhy

I Wonder

Updated on September 18, 2022

Comments

  • TellMeWhy
    TellMeWhy over 1 year

    How can I run a Python script which, upon execution, brings up a dialog prompting the user for his root password - so that the script is run as root, being able to make changes to files within the /... directories?
    I'm using Gtk-2

    • TellMeWhy
      TellMeWhy almost 9 years
      @JacobVlijm Not installed by default? even in Ubuntu and its derivatives? It's installed on my system...
    • Jacob Vlijm
      Jacob Vlijm almost 9 years
      Try my answer, I don't care for the points, but this is hurting my eyes.
  • TellMeWhy
    TellMeWhy almost 9 years
    So make an executable script containing gksu -u root '<script>'?