Sublime Text 3 is my primary text editor. I run it as a regular user, but once in a while I need to start is as root to edit some system files. I am used to having edit as root in my context menu on my old system.

In my old Linux Mint 13 Maya I used 'gksu subl'. In my new Linux Mint 17 Qiana this does not work. Here is what happens:

When I execute gksu subl I am prompted for a password with a graphical dialog. I enter the password which is accepted and then nothing happens. Command returns. No error message, no other indications of failure, but Sublime Text doesn't start.

Note, I am sure that gksu is present and working because gksu gedit works as expected - it asks for a password and then starts gedit with root privileges.

Also if I open the my file manager (Nemo) with root privileges and browse to text file and just double click it - the file opens in Sublime Text with root privileges. So I am sure that root can run Sublime Text.

Also if I try sudo subl, it works, but I don't want to use this as a solution for obvious reasons.

The problem seems to be specific to launching Sublime Text with gksu in Mint 17

Any ideas about why Sublime Text does not start with gksu and how to fix it?

Please do not suggest workarounds like "Use different text editor" and "launch file manager with gksu and then just open the text file for editing", I am looking for the solution to this particular problem


Finally found a solution. For some reason (probably bug), Sublime Text is exiting with success code right after starting, when it is started with gksu. To prevent this from happening I used -w argument passed to subl on startup

smc@smc-comp ~ $ subl --help Sublime Text build 3065

Usage: sublime_text [arguments] [files]         edit the given files
   or: sublime_text [arguments] [directories]   open the given directories

--project <project>: Load the given project
--command <command>: Run the given command
-n or --new-window:  Open a new window
-a or --add:         Add folders to the current window
-w or --wait:        Wait for the files to be closed before returning 
-b or --background:  Don't activate the application
-h or --help:        Show help (this message) and exit
-v or --version:     Show version and exit

Filenames may be given a :line or :line:column suffix to open at a specific location.

So the command looks like this:

gksu "subl -w %F"

Maybe this will save someone time looking at the same issue

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.