3

gksudo seeming to be somehow depreciated since 2017 as I see on the french forum documentation, is there an environment and version agnostic best practice allowing to use gedit as root?

(excluding vim, nano or tee: the use case being a GUI amendment of sources.list for instance)

My researchs brought me these proposals, are they equivalent or to be rejected :

  • pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gedit

  • gedit admin:///path/to/document

  • sudo -i gedit

  • sudo -H gedit

Any other ?

  • Also relevant: Why is gksu no longer installed by default?, the accepted answer to which explains a lot. – dessert Feb 25 '18 at 12:37
  • 3
    Your question makes an assumption... Best practice? Do not use elevated privileges with graphical applications at all. – Rinzwind Feb 25 '18 at 12:46
  • 1
    I knom elevated privileges should be avoided in GUI, but that is not the use case I'm trying to answer. I didn't see compared analysis of the commands I ask for in the proposed duplicates. – nam1962 Feb 25 '18 at 13:39
  • The duplicates with answers of 2014 don't answer, the most recent question for wayland isn't exploring all commands. – nam1962 Feb 25 '18 at 14:22
  • 1
    I'm a recent fan of using nautilus-admin for file operations as sudo and to use gedit as sudo: askubuntu.com/questions/156998/how-do-i-start-nautilus-as-root/… – WinEunuuchs2Unix Feb 25 '18 at 17:55

Browse other questions tagged or ask your own question.