Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there any difference between the behavior of gksu foo and gksudo foo?
Can they be used interchangeably?

share|improve this question
add comment

3 Answers

up vote 27 down vote accepted

There's absolutely no difference in Ubuntu because...

oli@bert:~$ ls -l /usr/bin/gksudo 
lrwxrwxrwx 1 root root 4 2010-09-27 18:23 /usr/bin/gksudo -> gksu

... gksudo is just symlinked to gksu.

share|improve this answer
To add to Oli's comment; Though gksudo is symlinked to gksu, In Ubuntu, by default we will only be using gksudo because we have the /apps/gksu/sudo-mode enabled. So unless someone forces the --su-mode option gksu is not used. –  Vish Apr 24 '11 at 8:50
@Oli: I wouldn't immediately conclude that there is no difference just because it's a symlink. Look at busybox, depending on the name of the symlink, different actions are performed. In this case, I don't know if it's true or not, but AFAIK it's indeed the case. –  Lekensteyn Jul 3 '11 at 9:31
-1, very misleading: software may behave differently depening on what name was used to invocate them. For example bash turns on POSIX strict mode when invoked as sh. And gksu is also aware of invocation name. –  MestreLion May 2 '13 at 18:53
add comment

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 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:

alt text

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)

share|improve this answer
add comment

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.

  1. Create three files in some folder:
    touch abc
    touch abc.tmp
    touch abctmp
  2. 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.

    find . -regextype posix-egrep -regex '.*\.tmp' -print
    sudo find . -regextype posix-egrep -regex '.*\.tmp' -print
    gksudo -- find . -regextype posix-egrep -regex '.*\.tmp' -print
    gksudo --su-mode -- find . -regextype posix-egrep -regex '.*\.tmp' -print
    gksu --sudo-mode -- find . -regextype posix-egrep -regex '.*\.tmp' -print
    gksu -- find . -regextype posix-egrep -regex '.*\.tmp' -print

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).

So, please use gksudo instead of gksu.

share|improve this answer
Just tried this on 12.04LTS. Don't yet fully understand why but there is a difference. The source code for gksu shows that gksudo is equivalent to typing gksu --sudo-mode –  Warren Hill Apr 30 '13 at 20:09
@WarrenHill — yes, in theory! But not in practice. I do not know why. –  Paddy Landau May 1 '13 at 9:22
Interesting, and verified on 13.04. Definitely looks like a quote handling bug. –  l0b0 Jun 2 '13 at 7:35
Filed a bug. –  l0b0 Jun 2 '13 at 7:46
@l0b0 - thanks, I've added my vote to the bug. –  Paddy Landau Jun 2 '13 at 12:15
show 2 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.