2009-06-29

【L】Ubuntu : sudo vs gksu

今天看到 Garlic 打了一個gksu的指令~

想說這是什麼鬼~~怎麼沒看過,

Google了一下後,找到一些解釋。

sudo 用來執行命令行(CLI)程序

  • CLI = Command Line Interface

gksu 用來執行圖形的(GUI)程序

  • GUI = Graphical User Interface

gksudo是結連到gksu,

所以不管是gksu還是gksudo都是執行/usr/bin/gksu,

如果輸入gksu 後面沒帶app name。就會跳出一個對話框如下圖。

Run:要執行的程式( ex:gedit )

As user:執行的身份

 

PS.如果已經用sudo切換成root,再執行gksu就會沒辦法執行。

 

附上一些查到的英文解釋

  • gksu and gksudo are in the graphical environments what su and sudo are in the terminal.
  • 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).
  • people should use gksudo in the terminal to launch a graphical application with root privileges; for example "gksudo gedit". It is also possible to use "sudo gedit", but it is not a good way to do it, because gksudo sets up things for a graphical environment, but sudo sets them up for a text environment. (or something like this)

0 comments:

張貼留言