Le 14/02/2020 à 14:12, Didier Kryn a écrit :
    I've found a solution on the web:

    Just 'su' - or 'sudo -u root bash -l' then

xauth add $(xauth -f ~<user>/.Xauthority list | tail -1) # where <user> is your username.

Then you can launch an application with a GUI.


    Hey. Here is a method to do it all automatically:

Edit /etc/sudoers:

*** WARNING for people not used to editing the sudoers file

Don't edit directly /etc/sudoers; instead invoke visudo (and RTFM for sudo, sudoers and visudo)

*** END OF WARNING

The goal is to add the following lines to sudoers:

Defaults env_keep = "EDITOR XAUTHORITY DISPLAY"
Defaults editor = /usr/bin/emacs:/usr/bin/vi:/bin/nano

Explanation:

    The variables listed in Defaults env_keep are preserved by sudo; XAUTHORITY and DISPLAY are used to forward your X session. EDITOR is usefull if you now want to invoke visudo without prior becoming root: edit your .bashrc (or the like) to set EDITOR to your preferred editor; tjhen, from your next session, you can run "sudo visudo".

    The second line is for security, ie make sure the application you pass as EDITOR is a valid editor and not a security exploit.

    For example my own EDITOR is set to 'emacs -nw'

    Then, from your session, you can run 'sudo synaptic'

    Beware, if you want to run 'sudo synaptic' by clicking on a .desktop icon, specify that you want to run it in a terminal, because sudo will need it to ask your password.

    Didier


_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to