I just heard that it isn't recommended to use sudo -i on GUI programs - because it's less secure.
Is there any truth here - is there an advantage to this:
sudo -i gedit /random/file.name
over
pkexec gedit /random/file.name
I used to use gksudo, but that's been phased out, so now I use sudo -i to prevent root owning files in my home area. But should I really be using pkexec?
Here is a reason:
The environment that PROGRAM will run [in], will be set to a minimal known and safe environment in order to avoid injecting code through
LD_LIBRARY_PATHor similar mechanisms. In addition thePKEXEC_UIDenvironment variable is set to the user id of the process invokingpkexec.
rootuser with UID 0 – Mudit Kapil Jul 13 '15 at 18:03sudocan't do (it can reset environment variables, and see the variablesSUDO_USERandSUDO_UID). – muru Jul 13 '15 at 18:13sudoin my answer. http://i.stack.imgur.com/eOXhJ.png – Tim Jul 13 '15 at 18:19pkexecis that another user can authorize for you, but I'm no security expert. By the way, we can still view the eOS.se beta, so you can link to the discussion directly. – muru Jul 13 '15 at 18:24pkexecneeds to be configured to run graphical programs. Ubuntu, Debian and Arch Linux don't configure it for that by default. Does elementary OS? If not, asking users to usepkexecis just a hassle. And where there's hassle, users will switch to easier commands. – muru Jul 13 '15 at 18:33sudo -His also enough. However I was recently downvoted on an answer in which I suggested this, so maybe I'm wrong on this one – kos Jul 13 '15 at 19:06