How can I edit an application's settings from the application menu?

After I install a program with my normal user account, it is always owned by the root user. The problem is that I can’t change any settings in the application menu even if I switch to root user.

Here is an example with wireshark:
I want to start Wireshark with sudo privileges from the application menu. But when I change the command (right window) to “sudo wireshark” the changes don’t persist.
It behaves the same when I switch to root user. How can I change these settings?

That isn’t how you change them. Right-click on the launcher and select “Edit Applications”. You should be able to save changes from there.

No, that doesn’t work either

Running Wireshark as root is discouraged, it is recommended that you add your user to the wireshark group. Replace <username> with yours.

sudo gpasswd -a <username> wireshark

You would need to logout and back in for this to be applied.

Hope this helps, or sorry if I missed what you are trying to accomplish.

What happens? How do you know it doesn’t work?

Also, using sudo from a .desktop file won’t work because there is no way to capture your password. You either need to set it to run in a terminal or use pkexec instead of sudo.

More importantly, you shouldn’t so it in the first place as @haakoth points out.

Wireshark works for me, I just used it as an example.

1 Like

When I try to change it as you described it doesn’t save the settings. If I then close the window, everything is back to normal

1: Edit command
2: Apply it
3: After closing the window, everything resets

Can you share the output of

ls -l ~/.local/share/applications

total 124
-rwxr-xr-x 1 kali kali 1599 22. Feb 00:03 appimagekit_e362259fc61c7fabd3f9d400485d005b-P3X_OneNote.desktop
-rwxr-xr-x 1 kali kali 1384 21. Feb 23:37 appimagekit_e66286e69d9eaf99b686021c943c4d07-Obsidian.desktop
-rwxr–r-- 1 kali kali 8650 7. Mär 20:21 brave-browser.desktop
-rw------- 1 kali kali 300 10. Apr 20:23 brave-nlalbmkafgmoifbeooblidblkmlhhpnc-Default.desktop
-rwxr–r-- 1 kali kali 13334 7. Mär 18:48 firefox.desktop
-rwxr–r-- 1 kali kali 15117 21. Feb 02:42 gimp.desktop
-rw-r–r-- 1 kali kali 3237 27. Apr 22:16 mimeinfo.cache
-rwxr–r-- 1 kali kali 10528 16. Feb 23:52 octopi.desktop
-rw------- 1 kali kali 538 7. Mär 21:09 org.kde.dolphin.desktop
-rwxr–r-- 1 kali kali 4985 27. Apr 22:27 org.wireshark.Wireshark.desktop
-rwxr–r-- 1 kali kali 6946 7. Mär 19:29 org.xfce.mousepad.desktop
-rwxr-xr-x 1 kali kali 17447 21. Feb 02:43 systemsettings.desktop
-rw------- 1 kali kali 231 21. Feb 22:10 Teamspeak.desktop
-rwxr–r-- 1 kali kali 1472 21. Feb 22:37 virtualbox.desktop
-rwxr–r-- 1 kali kali 745 7. Mär 20:17 visual-studio-code.desktop

What is the contents of ~/.local/share/applications/org.wireshark.Wireshark.desktop

cat ~/.local/share/applications/org.wireshark.Wireshark.desktop
[Desktop Entry]
Categories=Network;Monitor;Qt;
Comment[en_US]=Network traffic analyzer
Comment=Network traffic analyzer
Comment[af]=Netwerkverkeer analiseerder
Comment[ast]=Analizador de tráficu de rede
Comment[bg]=Анализатор на мрежовия трафик
Comment[bn]=নেটওয়ার্ক ট্রাফিক বিশ্লেষক
Comment[bs]=Analizator mrežnoga prometa
Comment[cs]=Analyzátor síťového přenosu
Comment[da]=Netværkstrafikanalyse
Comment[de]=Netzwerkverkehr-Analyseprogramm
Comment[el]=Ανάλυση κίνησης δικτύου
Comment[es]=Analizador de tráfico de red
Comment[et]=Võrguliikluse analüüsija
Comment[fi]=Verkkoliikenne analysaattori
Comment[fr]=Analyseur de trafic réseau
Comment[gl]=Analizador do tráfico de rede
Comment[hu]=Hálózatiforgalom-elemző
Comment[it]=Analizzatore del traffico di rete
Comment[ja]=ネットワークトラフィックアナライザー
Comment[ko]=네트워크 트래픽 분석기
Comment[ky]=Тармактык трафикти анализдөө
Comment[lt]=Tinklo duomenų srauto analizatorius
Comment[ms]=Penganalisa trafik rangkaian
Comment[nb]=Nettverkstrafikk-analysator
Comment[nl]=Netwerkverkeer analyseren
Comment[oc]=Analisador de tramas de ret
Comment[pl]=Analizator ruchu sieciowego
Comment[pt]=Analisador de tráfego da rede
Comment[pt_BR]=Analisador de tráfego de rede
Comment[ro]=Analizator trafic de rețea
Comment[ru]=Анализ сетевого трафика
Comment[sk]=Analyzátor sieťovej premávky
Comment[sl]=Preučevalnik omrežnega prometa
Comment[sq]=Analizues i trafikut të rrjetit
Comment[sv]=Nätverkstrafikanalysator
Comment[tr]=Ağ trafiği çözümleyicisi
Comment[uk]=Аналізатор мережевого трафіку
Comment[vi]=Trình phân tích giao thông mạng
Exec=sudo wireshark %f
GenericName[en_US]=Network Analyzer
GenericName=Network Analyzer
GenericName[af]=Netwerk Analiseerder
GenericName[az]=Şəbəkə Analiz Proqramı
GenericName[bg]=Анализатор на мрежови трафик
GenericName[bs]=Mrežni analizer
GenericName[ca]=Analitzador de xarxa
GenericName[cs]=Analyzátor sítě
GenericName[da]=Netværksanalyse
GenericName[de]=Programm für die Netzwerk-Analyse
GenericName[el]=Αναλυτής Δικτύων
GenericName[en_GB]=Network Analyser
GenericName[eo]=Retanalizilo
GenericName[es]=Analizador de redes
GenericName[et]=Võrguliikluse analüsaator
GenericName[eu]=Sare ikerketaria
GenericName[fa]=تحلیل‌گر شبکه
GenericName[fi]=Verkkoanalysaattori
GenericName[fr]=Analyseur réseau
GenericName[he]=מאבחן רשת
GenericName[hr]=Program za analiziranje mreža
GenericName[hu]=hálózatanalizáló
GenericName[id]=Analisis jaringan
GenericName[is]=Netskoðunartól
GenericName[it]=Analizzatore di rete
GenericName[ja]=ネットワークアナライザ
GenericName[ko]=네트워크 분석기
GenericName[lo]=ເຄື່ອງມືວິເຄາະເຄືອຂ່າຍ
GenericName[lt]=Tinklo analizatorius
GenericName[lv]=Tīkla Analizators
GenericName[mk]=Анализатор на мрежи
GenericName[mn]=Сүлжээ-шинжлэлийн програм
GenericName[mt]=Analizzatur tan-network
GenericName[nb]=Nettverksanalysator
GenericName[nl]=netwerkanalyseprogramma
GenericName[nn]=Nettverksanalysator
GenericName[nso]=Moahlaahli wa Kgokagano
GenericName[pl]=Analizator sieci
GenericName[pt]=Analisador de Redes
GenericName[pt_BR]=Analisador de rede
GenericName[ro]=Analizor de reţea
GenericName[ru]=Анализатор сетевого трафика
GenericName[se]=Fierbmeanalysa
GenericName[sk]=Analyzátor siete
GenericName[sl]=Analizator omrežij
GenericName[sr]=Analizatror mreže
GenericName[ss]=Sihlatiyi seluchungechunge
GenericName[sv]=Nätverksanalyserare
GenericName[ta]=Å¨Ä ¬öÅ¡Ç÷
GenericName[th]=เครื่องมือวิเคราะห์เครือข่าย
GenericName[tr]=Ağ Analiz Programı
GenericName[uk]=Аналізатор мережі
GenericName[ven]=Musengulusi wa Vhukwamani
GenericName[vi]=Trình phân tích mạng
GenericName[xh]=Umcukucezi Womsebenzi womnatha
GenericName[zh_CN]=网络分析程序
GenericName[zh_TW]=網路分析程式
GenericName[zu]=Umhloli Woxhumano olusakazekile
Icon=org.wireshark.Wireshark
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;application/x-tektronix-rf5;application/x-micropross-mplog;application/x-apple-packetlogger;application/x-endace-erf;application/ipfix;application/x-ixia-vwr;
Name[en_US]=Wireshark
Name=Wireshark
Name[vi]=Wireshark
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
TryExec=wireshark
Type=Application
Version=1.0
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

Looks like it worked.

Hm that’s weird because it doesn’t launch wireshark with sudo

Why are you running Wireshark as root? You shouldn’t be using sudo in this way.

Of course it doesn’t. Where do you type your password? :thinking:

1 Like

Well, I explained above that that you can’t just drop sudo in front of it because it will have no way to ask for the password.

Sometimes those things are cached and running kbuildsycoca5 will update the launcher.

1 Like

Oh yeah makes sense. I thought a window will pop up and force me to enter a password

You can do that two ways:

  • Set it to run in a terminal
  • Use pkexec instead of sudo

Although, again, you shouldn’t be running these applications as root.

1 Like

Just because one can, does not mean that one should.

Do not run Wireshark as root, it is insecure. Wireshark has implemented privilege separation, which means that the Wireshark GUI (or the tshark CLI) can run as a normal user while the dumpcap capture utility runs as root[1].

The wireshark-cli install script sets packet capturing capabilities on the /usr/bin/dumpcap executable.

/usr/bin/dumpcap can only be executed by root and members of the wireshark group, therefore to use Wireshark as a normal user you have to add your user to the wireshark user group.

https://wiki.archlinux.org/title/Wireshark#Capturing_privileges

Is this fixed?

Are you running kali?

Nope, some programs are owned by the user who installed them but most of them are owned by root.

No, this is just the username ^^