Is there a way to automatically run as
gksudo when I click on the Sublime Text icon?
Sublime Text should have a
.desktop file located in
Open it and change the
Exec= line to include
gksudo they are the same) at the beginning.
Now unpin and repin the sublime text icon to the launcher.
NOTE: Your path to the sublime executable will probably be different, that's because I installed the Sublime 3 beta, don't worry about it, just add
gksudo - is graphical sudo. For instance you won`t see Password dialog if you run command "sudo nautilus" using Alt+F2 You may make a script (sh file)
#!/bin/bash gksudo /usr/bin/<your_app>
chmod +x <your scrypt.sh>
And then run it in Nautilus (check option "ask what to do when opening executable files" in settings)
Like Seth said, Sublime Text should have a .desktop file located in /usr/share/applications/ named something like
You can then open it up and change the
exec= line to include
gksudo at the beginning, so it should now look like this:
gksudo <command already there for starting Sublime-text>.
While this will automatically launcher Sublime text with the gksudo window, you will still have to enter your password each time, which isn't what you want.
However, what you want is possible to do, but the only way I can think of would introduce a pretty serious security risk.
You would have to turn off the sudo timeout, which allows basically anything to run as sudo, without your permission, which basically defeats the entire purpose of the sudo password. Check out this question for some possible help with that.
All in all, I know of no way to do what you want entirely safely. If you don't mind risking your system a little, it can be done via turning off the sudo timeout, but I highly recommend against that.
You would still have to enter the sudo password each time you log on, but by turning off the sudo timeout you wouldn't have to enter it again until you logged out or rebooted.
gksu is deprecated and has been removed for security concerns.
see I need an equivalent of gksu in 18.04
long story short:
sudo -H subl
note that the
sudo -H is simple enough but it suffers the same security issues as
gksu. better option (for reasons beyond my understanding) would be
pkexec. there's also
admin:// protocol but it didn't work for me with sublime.