sudo vs. gksu

NoOp glgxg at sbcglobal.net
Sun Apr 6 18:02:16 UTC 2008


On 04/05/2008 06:11 AM, Tony Arnold wrote:
> Nils Kassube wrote:
>> Markus Schönhaber wrote:
>>> Mario Vukelic wrote:
>>>> No, gksu _is the right tool to use. sudo should never be used to
>>>> start graphical applications, as this could cause problems:
>>>>
>>>> https://help.ubuntu.com/community/RootSudo (in the "Notes" section)
>>> Since the above page only says "don't do it!" but doesn't explain what
>>> might happen otherwise: what problems are to be expected if one starts
>>> a graphical application with sudo?
>> 
>> With sudo some applications access / modify the user's config files as 
>> root. From then on they are owned by root and the user can no longer 
>> access / modify them. That leads to unusual error messages which only 
>> long time users can trace back to the permission problem. With gksu (or 
>> kdesu if you use kde) this problem is avoided.
> 
> Can you explain how this problem is avoided with gksu, or gksudo? So far
> as I can see using one of these causes the application to run with UID
> of 0, i.e., root. The app has no knowledge of how it was invoked, so any
> files is creates will be owned by root.

That is correct if you _create_ a file with gksu without specifying a
user other than root. However, when _editing_ an existing file, gksu
maintains the environment by default. See:

http://linux.die.net/man/1/gksu

man gksu

If you invoke gksu on it's own, you will be presented with a GUI that
you can use to change the user, maintain the enviroment etc. Or do it
from the command line:

gksu [-u <user>] [options] <command>
gksudo [-u <user>] [options] <command>

Further, gsku will automatically create a ~ temp file of the file being
edited, so you always have a backup.

sudo does not, unless used with the -e option or sudoedit is used.











More information about the ubuntu-users mailing list