In Ubuntu 18.04, when the user clicks on a custom desktop file, the program displays the message that the application launches is not trusted and launching it may be unsafe. The desktop also does not display the correct icon for the desktop file.

How is it possible to mark the application launches desktop file as trusted so that the message does not get displayed, and the ICON is also displayed on the desktop.

I tried using

chmod +x *.desktop

as suggested in some queries but this does not seem to work in 18.04.

  • I too am having this exact same issue, every time I click the .desktop file, it asks to "trust and launch", and it opens, but it asks me the same thing every time (on the same file), and the icon never updates. The weird thing is, I think it started around the time I had to restart X11 (startX) because I had an app freak out when it was full screen. Did you ever find a solution to this?
    – Jared
    Commented Aug 18, 2018 at 21:27

8 Answers 8


None of the answers provided up to this point have included information about how you can do this in a non-interactive manner. What if I want to script the creation of a launcher and make it trusted without having to click on it?

This usage case is already addressed in this question with this answer. I'm duplicating this information here because this question was much easier to find, and it is not strictly a duplicate because the question here is larger in scope.

To set a launcher as trusted from the command line, run:

gio set /path/to/your/launcher.desktop "metadata::trusted" yes

With that done, press F5 on the desktop or in the current folder to refresh the view. The launcher should now be trusted.

There are certain conditions that must be met (ownership, running programs, running gio as the correct user). See Sander's answer for the full list.

  • It hasn't worked to me at 18.04. The target .desktop file stay with the Allow executing file as program checkbox unmarked in properties menu
    – artu-hnrq
    Commented Mar 22, 2020 at 18:33
  • I had a new .desktop file as launcher on desktop, with correct icon path and everything, it ran the executable and all (so it was trusted) - and it wouldn't show the icon, until I hit F5 on the desktop; thanks for this tip!
    – sdaau
    Commented Apr 13, 2020 at 8:31
  • This has worked for me, but I had to change yes to true (and the chmod +x is also required)
    – romaia
    Commented Feb 21, 2022 at 2:08
  • First set the executable bit of the .desktop file like you did already. You may also do this by right-clicking the file in the file manager and setting the executable property on the "Permissions" tab of the "Properties" dialog if you find that easier than the command line.
  • Now try launching the icon again by double-clicking it. Again, a dialog appears, but note: it is a different dialog. This time, select the "Launch and trust" button, and your desktop file will now turn into a functional launcher with the right icon.
  • 1
    Thanks for your response. My problem is that I do not want any message to appear when I click on the icon. How do you mark the application as trusted by default? The icon also needs to be displayed.
    – arun nath
    Commented Jul 17, 2018 at 7:37
  • Please read again carefully what I wrote, and first try it out. That is the procedure to mark a launcher as "trusted". Once you have done that, the launcher will work as expected and immediately launch your application. You asked "How is it possible to mark the application launches desktop file as trusted so that the message does not get displayed, and the ICON is also displayed on the desktop." and this is the answer on "how".
    – vanadium
    Commented Jul 17, 2018 at 10:04
  • I am able to launch the application. All that works well. But the desktop file does not turn into the ICON. Also when I close the application, and try to launch it again, the message pops up again. There does not seem to be a way to do away this the pop up message once and for all. Keeps popping up all the time. I hope I am not missing something here.
    – arun nath
    Commented Jul 17, 2018 at 10:44
  • You mean, you are able to launch the application from your untrusted launcher after answering the dialogs, but then the launcher does not become "trusted"? That is not normal behavior. On my system, I need to do this once, then the launcher is "trusted" and this is being remembered.
    – vanadium
    Commented Jul 17, 2018 at 11:04
  • That's right it does not seem to remember it anymore. It used to work like what you had suggested. The latest series of Ubuntu 18.04 updates seems to have broken it.
    – arun nath
    Commented Jul 17, 2018 at 13:48

after hours of searching, I finally found what was causing my problem with the .desktop files never being trusted and not showing icons:

Change the owner to your user name (mine was set to root which was breaking things):

sudo chown $USER:$USER ~/.local/share/gvfs-metadata/home*

credit to @George Udosen who helped me fix it: GVFS-WARNING **: can't init metadata tree /home/user/.local/share/gvfs-metadata/home: open: Permission denied

  • 3
    Didn't work for me. Those files were already set to the proper owner. Commented Nov 20, 2018 at 17:15

Set the proper user name and group name for the particular desktop file (chown) . Now try to launch again, dialog appears select the "Launch and trust" button.

  • 1
    I had the problem that there was already the right user and group set. Sadly not really as I installed Ubuntu ontop again and remounted the home directory with the same user name. Turned out that a user with the same name is not per se the same user. With sudo chown -R myuser:myuser ~/everything worked without any problems and no need to restart. Commented Jun 22, 2019 at 16:50
  • I have the same problem. In addition, if I double click on the .desktop file in /home/${users}/.local/share/applications/EclipseWeb.desktop when using Nautilus,I get a message stating: Error launching application and I can find no information to help me interpret the message.
    – Jonathan
    Commented Apr 21, 2020 at 17:31

And just to add to b_laoshi 's answer - after updating from 16.04 to 18.04 I had a desktop full of steam links I didn't want to have to open each game and then quit to trust them

for i in ~/Desktop/*.desktop; do    gio set "$i" "metadata::trusted" yes ;done

You should never trust code from stackoverflow without being sure what it does:

  • set "$i" in turn to the full path of each file on your desktop named desktop
  • runs

    gio set </home/path/to/your/whatever.desktop> "metadata::trusted" yes

    for each

  • done marks the end of the loop
  • I had the same problem and neither gio nor chown would change the group or owner.
    – Jonathan
    Commented Apr 19, 2020 at 0:09
  • gio won't change the owner or group - it just tells gnome to trust it. check the owner/group with stat filename, if chown isn't working check any error messages, you can only run it as root (ie with sudo) and some filesystems (eg file shares, SD cards, windows disks) won't support it
    – Greg
    Commented Apr 20, 2020 at 1:57
  • Thanks, It worked for me
    – mss
    Commented Jul 18, 2020 at 20:51

I created a .desktop file, and it was blocked. Then I made it executable, and then I got a pop-up which allowed me to start the application. Finally, I copied the desktop file to /usr/share/applications Now it starts without a pop-up.


None of these worked for me except to delete gvfs-metadata

sudo rm ~/.local/share/gvfs-metadata/home
  • 2
    @Paul Is there any specific reason that you ran the rm command to remove a file inside your home directory with sudo? Usually running commands willy-nilly with sudo when it's not necessary is not a good idea. It might cause issue with file permissions and lead to a breakage.
    – pomsky
    Commented Jul 11, 2020 at 12:36
  • I suspect there were permission issues in my system (which were causing the initial issue), I suppose I should have tried it without sudo first, but was frustrated by that stage as none of the other solutions I had found worked and wanted to be sure the command took effect.
    – Paul B
    Commented Jul 12, 2020 at 20:49

This worked perfectly for me: just right-click, select permissions, and check "Allow Executing of This Program," or something similar.

  • Kubuntu Noble: gio: Setting attribute metadata::trusted not supported Commented Feb 19 at 4:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .