著者: Didier Kryn 日付: To: dng 題目: Re: [DNG] why is polkit needed?
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:
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.