gksu
is basically a graphical frontend for sudo that allows graphical command to be run without the need to run an X terminal emulator and using su directly. It's effectively just a GTK+ skin for the superuser commands.
So if you wanted to run a GUI based program as root, you would invoke it with gksu cmd
, rather than sudo cmd
, which is used for invoking console programs as root.
Both files point to the same place:
$ ls -l /usr/bin/gksudo
lrwxrwxrwx 1 root root 4 2010-09-27 18:23 /usr/bin/gksudo -> gksu
... 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.
Best Answer
chroot
is a way of entering a folder and 'faking' that folder being/
to anything executed inside. This lets you run executables on a non-booting Ubuntu installation by mounting it somewhere other than/
and using/bin/bash
(the one inside the installation) to get a terminal prompt.sudo
- Lets certain accounts authenticate to run a program as root or another user. Some programs may not need a password as defined in thesudoers
file. Whether the request is allowed or not depends on the user(and group) runningsudo
, and the command to be run, as defined insudoers
.su
- Also a way of elevation, but has differences as it performs a full interactive logon as root(or another user), and gives a bash prompt unless specified otherwise with arguments. It uses the target user's credentials as authentication.visudo
- Edits thesudoers
file. This uses a special executable that checks the syntax of the file to ensure you are not locked out ofsudo
due to a corruptedsudoers
file. If you attempt to save an invalid configuration it will stop you, and return you to the editor to fix it.gksudo
orgksu
is the same as sudo except it is graphical and rewrites some paths so that graphical programs do not cause permission issues on the user's profile, especially with~/.Xauthority
.