18

What is the difference between sudo, kdesudo and gksudo, and when should I use each? I know that sudo allows me to run both cli and gui functions, but I've seen other people on websites using kdesudo and gksudo for gui functions.

SamuelH
  • 826
  • 2
  • 10
  • 22
  • Interesting question but it can also be found here http://superuser.com/q/202676/302835 – bacon Feb 24 '14 at 17:09
  • related: http://askubuntu.com/questions/21033/what-is-the-difference-between-gksudo-and-gksu and worth further reading: http://askubuntu.com/questions/78352/when-to-use-pkexec-vs-gksu-gksudo – Takkat Feb 24 '14 at 20:59

1 Answers1

14

sudo stands for Super User Do. That means it provide privileges of the root/main user via terminal. Learn more about sudo from its official site.
From Vinicius's comment

It originally stood for 'superuser do' as the older versions of sudo were designed to run commands only as the superuser. However, the later versions added support for running commands not only as the superuser but also as other (restricted) users, and thus it is also commonly expanded as 'substitute user do'. Although the latter case reflects its current functionality more accurately, sudo is still often called 'superuser do' since it is so often used for administrative tasks.

gksudo and kdesudo both are also sudo thing except that first one is use for graphical sudo operation which works using GUI instead of terminal and second one is gksudo alternative for Kubuntu.

And a short note from wiki

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

Sparhawk
  • 6,929
Nabil
  • 2,142
  • su is not 'super user', but 'switch user', the user to switch to is an optional argument, which default valus is root – Youda008 Apr 18 '17 at 12:51
  • @Youda008 AFAIK sudo stands for 'super user do'. If you have any reference add them here please. – Nabil Apr 18 '17 at 16:49
  • the "man sudo" on Ubuntu will tell you "Execute a command as another user" @Youda008 seems to be right. I guess the "super user do" is a simplification. Anyway, so much for the detail ;) – valkalon Apr 09 '18 at 06:51
  • 1
    Just as a curiosity, from Wikipedia: "It originally stood for 'superuser do' as the older versions of sudo were designed to run commands only as the superuser. However, the later versions added support for running commands not only as the superuser but also as other (restricted) users, and thus it is also commonly expanded as 'substitute user do'. Although the latter case reflects its current functionality more accurately, sudo is still often called 'superuser do' since it is so often used for administrative tasks." https://en.wikipedia.org/wiki/Sudo – Vinicius May 09 '18 at 02:22
  • I understand with 18.04 that one can no longer do gksu gedit /path/to/file.txt to edit a file, and instead one must now do gedit admin:///path/to/file.txt as discussed here https://www.maketecheasier.com/gksu-alternatives-ubuntu-bionic/ – pdc Aug 24 '18 at 23:55
  • If sudo is somehow related to su, it must be substitute user, according to Wikipedia and the FreeBSD man page of the su command. – rexkogitans Apr 15 '19 at 15:17