Ways to run Nautilus with elevated privileges [duplicate]

What are the differences between the following ways to run Nautilus with elevated privileges:

a)

sudo nautilus

b)

gksu nautilus

c)

gksudo nautilus

Which should I use?


Solution 1:

The difference is that sudo nautilus won't initialise properly:

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

from: RootSudo (help.ubuntu)

It is advised to always use gksudo

Solution 2:

The last two alternatives, because they create a loginshell. Anyways gksudo is just a soft link to gksu :)

The first one has a potential problem with inherited environment variables. You might end up writing stuff in your home directory as root.

Solution 3:

Open terminal, And type : ls -l /usr/bin/gksudo

From this result u can see that between gksudo and gksu is same because gksudo is symbolic link to gksu . gksu and gksudo are only frontend for su , like sudo ---> su.The diference is when you type sudo you must insert your user password not root password.I think it's usefull for computer that so many user in it that we dont have to know root password exactly.So it's about security because it's danger if using root. Sudo is a way better instead using su.We just have to add the user to member group of sudo. Member group of sudo can be root with just "one password" . gksu/gksudo is graphical frontend to using su, but the diference is when we use gksu/gksudo it will preserve our desktop settings configuration so "root" not change ur desktop setting and crash ur system home.