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.
/usr/share/applications/sublime-text.desktop
:
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=gksu /opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;
[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
OnlyShowIn=Unity;
[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
OnlyShowIn=Unity;
Best Answer
When
gksu
/gksudo
doesn't work or is unavailable, you can usesudo -H
instead.If you run a graphical program with
sudo
instead ofgksu
/gksudo
, you should usesudo -H ...
(orsudo -i ...
) instead of justsudo ...
.(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 itsHOME
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 ofsudo -H
andsudo -i
, when the goal is just to run graphical programs as root without problems.