40

Possible Duplicate:
What is the difference between “gksudo nautilus” and “sudo nautilus”?

I have tiny script that I want it to run on start-up, but it needs sudo privileges so I use gksudo for the job. but it fails. (it works correctly using sudo.) Is there any difference between sudo and gksudo beside the inteface?

BTW: this is the tiny script I mentioned:

#!/bin/bash

cat /sys/devices/platform/sony-laptop/kbd_backlight|if read state; then \
    echo $((1-$state)) | sudo tee /sys/devices/platform/sony-laptop/kbd_backlight; fi;
Untitled
  • 1,468

1 Answers1

40

The main difference is as follows :

gksudo : is used to run graphical (GUI) applications as root
sudo : is used to run command line applications as root

The reason your script won't work with gksudo is because you can't run a GUI without X running.

Volker Siegel
  • 13,295