I know I am not root because I cannot browse packages. First, I am aware of this page, but it is not working for me. After following those instruction, I get the prompt when I open Sublime from Unity, but I am still not able to browse packages. If I open sublime using gksu subl in the terminal, nothing happens. If I do sudo subl it opens and I can browse packages. Is it OK to open sublime as sudo every time instead of gksu?

Edit: Actually, when I open sublime from Unity, it prompts for the password, then doesn't open at all.

Edit: gksudo subl has the same effect as gksu. I installed Sublime from the website (clicked the Ubuntu 64 link, it downloaded, clicked the download, it took me to Software Center). "which subl" returns /usr/bin/subl. gksu is installed. Glutanimate, yes that is what I mean. Any idea what is happening then? I can only browse them if I use sudo.


[Desktop Entry] 
Name=Sublime Text
GenericName=Text Editor 
Comment=Sophisticated text editor for code, markup and prose 
Exec=gksu /opt/sublime_text/sublime_text %F

[Desktop Action Window] 
Name=New Window
Exec=/opt/sublime_text/sublime_text -n 

[Desktop Action Document] 
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
  • (Really) silly question, but you did install gksu didn't you? It isn't installed by default. – Jacob Vlijm Aug 30 '14 at 6:00
  • When you say "browsing packages", do you mean the ST package manager? I am asking because you shouldn't need root to browse/install/remove Sublime Text packages. – Glutanimate Aug 30 '14 at 7:21

When gksu/gksudo doesn't work or is unavailable, you can use sudo -H instead.

If you run a graphical program with sudo instead of gksu/gksudo, you should use sudo -H ... (or sudo -i ...) instead of just sudo ....

sudo -H subl
sudo -i subl

(Neither plain sudo ... nor those ways will typically work from the Unity dash, because they need a terminal on which to prompt you for your password. But you can run them from the Terminal.)

The main reason it's considered bad to run a graphical program with normal sudo is that this runs the application with its HOME environment variable set to non-root caller's home directory (/home/username) rather than root's home directory (/root). That often causes configuration files that should belong to the regular user, to belong to root instead (and inaccessible).

Running sudo with the -H flag prevents this by making sure root's home directory is used instead.

sudo -i does this and more: it runs a program in a simulated root login session. I'm not aware of any strong reasons to prefer one or the other of sudo -H and sudo -i, when the goal is just to run graphical programs as root without problems.

  • When will pkexec grow up, so that we can skip this mess? – muru Aug 30 '14 at 15:24
  • 1
    @muru polkit/PolicyKit is quite capable., but pkexec intentionally won't run graphical apps without polkit profiles. Usually gksu/gksudo work; even with this weird situation (that may be a bug but I don't want to rush and assume that), I don't know that a polkit way of running arbitrary apps as root would be more reliable overall. But there is a polkit-based gksu implementation (README). – Eliah Kagan Aug 30 '14 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.