Skip to content

gksu and gksudo

IMPORTANT

Basically `gksu and gksudo have been deprecated. You should read at first: How to run GUI application as root

WARNING

gksu has been removed from repo's since Ubuntu 18.04 / Mint 19


The gksu and gksudo commands allow you to elevate your permissions when running graphical applications.

They are essentially equivalent graphical commands to the su command and the sudo command.

Installation (deprecated)

You can install it within Ubuntu/Mint from the command line using the apt-get command as follows (but it usually include in Mint):

sudo apt-get install gksu

Usage (deprecated)

Usage: gksu [-u <user>] [options] <command>

  --debug, -d
    Print information on the screen that might be useful for diagnosing and/or solving problems.

  --user <user>, -u <user>
    Call <command> as the specified user.

  --disable-grab, -g
    Disable the "locking" of the keyboard, mouse, and focus done by the program when asking for password.

  --prompt, -P
    Ask the user if they want to have their keyboard and mouse grabbed before doing so.

  --preserve-env, -k
    Preserve the current environments, does not set $HOME nor $PATH, for example.

  --login, -l
    Make this a login shell. Beware this may cause problems with the Xauthority magic.
    Run xhost to allow the target user to open windows on your display!

  --description <description|file>, -D <description|file>
    Provide a descriptive name for the command to be used in the default message, making it nicer.
    You can also provide the absolute path for a  .desktop file. The Name key for will be used in this case.

  --message <message>, -m <message>
    Replace the standard message shown to ask for password for the argument passed to the option.
    Only use this if --description does not suffice.

  --print-pass, -p
    Ask gksu to print the password to stdout, just like ssh-askpass. Useful to use in scripts with
    programs that accept receiving the password on stdin.

  --sudo-mode, -S
    Make GKSu use sudo instead of su, as if it had been run as "gksudo".

  --su-mode, -w
    Make GKSu use su, instead of using libgksu's default.

Samples (deprecated)

Typically gparted should always be run as root

gksu gparted

If you want to modify a protected configuration.

gksu gedit /etc/samba/smb.conf

Tips (deprecated)

Never use sudo xed , sudo gedit or any sudo on GUI application to avoid to create file owned by root into your configuration.

Alternative (deprecated)

On some distribution you might use kdesudo