Ubuntu – n easier or more ‘correct’ way to open gedit as root

geditunity-dash

I have ubuntu 12.04 running in a virtual machine on virtual box. Its existence is mainly as a 'toy' to play about with Ubuntu, so for this reason I wanted the GUI (is that what 'Dash' is in ubuntu 12.04? Anyway…)

One thing I am currently using this machine for is a LAMP server. I use 'gedit' to edit my files, but because I haven't correctly set permissions yet I just open it with sudo in terminal.

Just now, to try to simplify this process I created a shell script on the desktop with a very simple job – sudo gedit

I can't help thinking there must be an even more obvious way to open gedit as root from the GUI than this. So is there?

Edit: I just 'improved' my script by replacing sudo with gksudo. Now I don't have to have a terminal window open while gedit is open. So I guess this is quite convenient for now 🙂 It would be good, for the sake of knowledge, to know if this is anything close to how the more seasoned ubuntu users would do this type of thing.

Best Answer

Use gksudo gedit.

gksudo is the equivalent of sudo for graphical programs, which are not safe to run using sudo.

Related Question