... gksudo is symlinked to gksu. But this doesn't mean they do the same things, far from it.
Applications can detect the command used to run it. This is typically argv[0] in C-style languages or $0 in Bourne-style shell scripts. The application can look at that and in this case, actually it changes how it works. The first indication of this is in the man gksu page:
gksu is a frontend to su and gksudo is a frontend to sudo.
If you look in the source (apt-get source gksu) for run_mode, you'll see how it detects this:
{ /* support gksu_sudo_run */
gchar *myname = g_path_get_basename (argv[0]);
if (!strcmp(myname, "gksudo"))
run_mode = SUDO_MODE;
g_free (myname);
}
You can override this with the --su-mode/-w and --sudo-mode/-S arguments (so you can run equivalent commands without needing the gksudo symlink... But that's up to you.
If you want to know how these "modes" really differ, there's only a bit of escaping in gksu. You need to follow it into libgksu. This is the library that actually checks permissions before handing off to the system.
If no mode is specified (eg you call gksu without arguments) by the time it reaches libgksu, it will check Gconf (as Stefano points out) and if it still can't decide, it'll default to the su mode.
gksu would normally log in the root user and run an app on this session. However, on Ubuntu, it defaults to using the "sudo mode", which is equivalent of running gksudo. This is because on ubuntu, you can't log in as root by default.
gksudo is the graphical equivalent of sudo (and as Oli points out, just a symbolic link to gksu)
From the gconf entry of gksu:
Furthermore, on the difference between sudo and gksudo:
You should never use normal sudo to start graphical applications as root. You should use gksudo (kdesudo on Kubuntu) to run such programs. gksudo sets HOME=~root, and copies .Xauthority to a tmp directory. This prevents files in your home directory becoming owned by root. (AFAICT, this is all that's special about the environment of the started process with gksudo vs. sudo). — (from the community documentation via Chris Wilson)
I know that this is an old thread, but I've been asked to tell you about a subtle but essential difference between gksu and gksudo.
Although I have looked long and hard, I cannot find a documented difference anywhere, and yet it does exist. I have also not found out why there is a difference. I found this the hard way when I accidentally deleted some system files precisely because of this difference (discussed in a thread in Ubuntu Forums) — I had been using gksu, but since then I have made sure always to use gksudo.
To summarise, try this.
Create three files in some folder: touch abc touch abc.tmp touch abctmp
Run the following six commands. The first five give the same (expected) result (i.e. just abc.tmp) whereas the sixth includes an extra file (abctmp) that it shouldn't.
Imagine the problems when you replace -print with -delete in the find command (which is exactly what happened to me, causing some system files to be deleted).
Both files point to the same place:
...
gksudo
is symlinked togksu
. But this doesn't mean they do the same things, far from it.Applications can detect the command used to run it. This is typically
argv[0]
in C-style languages or$0
in Bourne-style shell scripts. The application can look at that and in this case, actually it changes how it works. The first indication of this is in theman gksu
page:If you look in the source (
apt-get source gksu
) forrun_mode
, you'll see how it detects this:You can override this with the
--su-mode
/-w
and--sudo-mode
/-S
arguments (so you can run equivalent commands without needing thegksudo
symlink... But that's up to you.If you want to know how these "modes" really differ, there's only a bit of escaping in
gksu
. You need to follow it intolibgksu
. This is the library that actually checks permissions before handing off to the system.If no mode is specified (eg you call
gksu
without arguments) by the time it reacheslibgksu
, it will check Gconf (as Stefano points out) and if it still can't decide, it'll default to thesu
mode.In Ubuntu (!), there is no difference.
gksu
would normally log in the root user and run an app on this session. However, on Ubuntu, it defaults to using the "sudo mode", which is equivalent of runninggksudo
. This is because on ubuntu, you can't log in as root by default.gksudo
is the graphical equivalent ofsudo
(and as Oli points out, just a symbolic link to gksu)From the gconf entry of gksu:
Furthermore, on the difference between sudo and gksudo:
I know that this is an old thread, but I've been asked to tell you about a subtle but essential difference between
gksu
andgksudo
.Although I have looked long and hard, I cannot find a documented difference anywhere, and yet it does exist. I have also not found out why there is a difference. I found this the hard way when I accidentally deleted some system files precisely because of this difference (discussed in a thread in Ubuntu Forums) — I had been using
gksu
, but since then I have made sure always to usegksudo
.To summarise, try this.
touch abc
touch abc.tmp
touch abctmp
Run the following six commands. The first five give the same (expected) result (i.e. just
abc.tmp
) whereas the sixth includes an extra file (abctmp
) that it shouldn't.Imagine the problems when you replace
-print
with-delete
in thefind
command (which is exactly what happened to me, causing some system files to be deleted).So, please use
gksudo
instead ofgksu
.