PDA

View Full Version : Double-click launch a bash script with sudo



japhyr
January 7th, 2011, 06:32 PM
Hello,

I am writing a bash script to automate the installation of packages when I configure a new computer. The script is working, but since many of the commands need root privileges, I have to run the script from the terminal, ie "sudo /home/username/Desktop/script.sh". If I double click the script icon on the Desktop, the program runs but fails quickly because it does not have root privileges.

Is there a way to gain root privileges after clicking the script icon?