gksudo 16.10

Ralf Mardorf silver.bullet at zoho.com
Fri Nov 4 14:23:43 UTC 2016


On Fri, 04 Nov 2016 14:28:28 +0100, Nils Kassube wrote:
>Applications that want to use any of those files / folders, which are 
>now owned by root, may no longer work correctly if run as a normal
>user.

You still could use the apps, as long as 'others' have got 'r-x' often
even just 'r--' permissions to those files. And as pointed out earlier,
you could either use

  sudo -i
  appname

or

  sudo HOME=/root appname

if it should be important, that the 'user' (owner) of those files
shouldn't change, required assuming the user should still be able to
e.g. change the config of an app or to execute something related to
the app, without 'rwx' permissions for 'others'.

It's a matter of taste and awareness. I dislike that a password window
opens, so I prefer to use sudo, let alone that

  gksudo -u some_other_user_but_not_root app

anyway requires to run xhost, as well as sudo -u does. IOW gksudo does
_not_ provide advantages related to X.

If you often need to work with root privileges you anyway would use

  sudo -i

and if required e.g. to edit user's dconf run

  HOME="/home/foo
  sudo -u foo gsettings set ...
  HOME="/root"

  HOME="/home/foo
  cat ... | sudo -u foo dconf load ...
  HOME="/root"

  xhost +; sudo -c foo pluma; xhost -

if you are used to it, then you could be used to do the same to get
root privileges and you even don't need to use 3 lines, as done above,
to make it clear, just run

  sudo HOME=/root appname

HOME=/home/foo or =root doing before running sudo could be an advantage
too, if you don't want to repeat it for several commands.

HOME=/home/foo
sudo ...
sudo ...
sudo ...
HOME=/root

or vice versa.

Regards,
Ralf





More information about the ubuntu-users mailing list