Page 1 of 1

difference sudo vs gksudo?

Posted: Sun Nov 06, 2016 12:51 pm
by Canedje
What is the difference between the gksudo and sudo command?

Re: difference sudo vs gksudo?

Posted: Sun Nov 06, 2016 1:07 pm
by DougieLawson
sudo elevates privileges in an ordinary shell. gksudo elevates privileges in an Xwindows shell.

You shouldn't need to use either for normal programs. Even wiggling GPIO pins doesn't need root auth with GPIOzero.
https://gpiozero.readthedocs.io/en/v1.3.1/
https://www.raspberrypi.org/blog/gpio-z ... computing/

Re: difference sudo vs gksudo?

Posted: Sun Nov 06, 2016 1:09 pm
by tpylkko
Use

Code: Select all

man sudo
to read the manual. And

Code: Select all

man gksudo
. Often you can find information abou packages like this. See

Code: Select all

man man

Re: difference sudo vs gksudo?

Posted: Sun Nov 06, 2016 1:16 pm
by Canedje
thanks
that explains it to use it for a x window command

Re: difference sudo vs gksudo?

Posted: Sun Nov 06, 2016 3:18 pm
by HawaiianPi
Canedje wrote:What is the difference between the gksudo and sudo command?
gksudo : is used to run graphical (GUI) applications as root
sudo : is used to run command line applications as root

Often using sudo with graphical applications will work, but there have been issues in the past, so best practice is to use sudo for commands that run in the terminal or from the CLI, and gksudo (or gksu) to run desktop/GUI applications.

Re: difference sudo vs gksudo?

Posted: Sun Nov 06, 2016 4:56 pm
by DougieLawson
HawaiianPi wrote: Often using sudo with graphical applications will work, but there have been issues in the past, so best practice is to use sudo for commands that run in the terminal or from the CLI, and gksudo (or gksu) to run desktop/GUI applications.
It's best practice to ONLY use sudo or gksudo when you absolutely must have elevated privileges. Too many users on too many systems assume sudo is the answer to all of their troubles. It usually isn't and is simply an ugly way to bypass security that's there to prevent you shooting the system dead in error.