Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

difference sudo vs gksudo?

Sun Nov 06, 2016 12:51 pm

What is the difference between the gksudo and sudo command?

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: difference sudo vs gksudo?

Sun Nov 06, 2016 1:07 pm

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/
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

tpylkko
Posts: 409
Joined: Tue Oct 14, 2014 5:21 pm

Re: difference sudo vs gksudo?

Sun Nov 06, 2016 1:09 pm

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

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: difference sudo vs gksudo?

Sun Nov 06, 2016 1:16 pm

thanks
that explains it to use it for a x window command

User avatar
HawaiianPi
Posts: 5838
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: difference sudo vs gksudo?

Sun Nov 06, 2016 3:18 pm

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.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: difference sudo vs gksudo?

Sun Nov 06, 2016 4:56 pm

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.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Beginners”