erro: XDG_RUNTIME_DIR não definido no ambiente

1

Eu quero lançar o wireshark usando o seguinte comando:

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
    
por user453850 23.09.2015 / 11:53

1 resposta

1

Crie uma nova regra de política em /usr/share/polkit-1/actions/

sudo nano /usr/share/polkit-1/actions/wireshark.policy

e adicione as linhas abaixo:

<?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>

Em seguida, crie um novo script wireshark-pkexec

sudo nano /usr/bin/wireshark-pkexec

e adicione as linhas abaixo:

#!/bin/sh
pkexec "wireshark" "$@"

e adicione o sinalizador de executável

sudo chmod +x /usr/bin/wireshark-pkexec   

E finalmente crie um novo arquivo de área de trabalho

nano /usr/share/applications/wireshark-pkexec.desktop

e adicione as linhas abaixo:

[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;

Reinicie o Unity / GNOME Shell e inicie o Wireshark como root

    
por A.B. 23.09.2015 / 12:58