Je veux lancer wirehark en utilisant la commande suivante:
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY wireshark
No protocol specified
** (wireshark:9323): WARNING **: Could not open X display
No protocol specified
error: XDG_RUNTIME_DIR not set in the environment.
(wireshark:9323): Gtk-WARNING **: cannot open display: :0
Créer une nouvelle règle de politique dans /usr/share/polkit-1/actions/
Sudo nano /usr/share/polkit-1/actions/wireshark.policy
et ajoutez les lignes ci-dessous:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="org.freedesktop.policykit.pkexec.run-wireshark">
<description>Run FlashTool</description>
<message>Authentication is required to run Wireshark</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/wireshark</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>
</action>
</policyconfig>
Puis créez un nouveau script wireshark-pkexec
Sudo nano /usr/bin/wireshark-pkexec
et ajoutez les lignes ci-dessous:
#!/bin/sh
pkexec "wireshark" "$@"
et ajouter le drapeau exécutable
Sudo chmod +x /usr/bin/wireshark-pkexec
Et enfin créer un nouveau fichier de bureau
nano /usr/share/applications/wireshark-pkexec.desktop
et ajoutez les lignes ci-dessous:
[Desktop Entry]
Name=Wireshark as root
GenericName=Network Analyzer
Comment=Network traffic analyzer
Exec=wireshark-pkexec %f
Icon=wireshark
Terminal=false
Type=Application
Categories=GNOME;Network;
StartupNotify=true
MimeType=application/vnd.tcpdump.pcap;application/x-pcapng;application/x-snoop;application/x-iptrace;application/x-lanalyzer;application/x-nettl;application/x-radcom;application/x-etherpeek;application/x-visualnetworks;application/x-netinstobserver;application/x-5view;
Redémarrez Shell Unity/GNOME et démarrez Wireshark as root