Ubuntu – 17.10 / 18.04.TLS .desktop files are no longer trusted

17.1018.0419.04desktop

I've moved from 17.04 to 17.10 (by update, not fresh install)

I have a bunch of customized .desktop files in my desktop.

When I try to run then, I get a message telling me these are "untrusted", and I have to retrust them manually.

Is there a way to trust them all?

note:

  • desktop files have executable bit set (I have run chmod +x).
  • before trusting they appear as a generic file, after with proper icon (e.g. terminal, browser, …)
  • worked fine before (that is icons and action were OK in 17.04)
  • desktop to samba share are OK.

edit:

  • files are not located in /tmp neither in $HOME.

I have read :

Execute-Permission Bit Required

  • Applications, including desktops and shells, must not run executable code from files when they are both:
    – lacking the executable bit
    – located in a user's home directory or temporary directory.
  • my desktop are in neither of those.
  • This includes *.desktop, *.jar, and *.exe files.
  • .desktop files being r--r--r-- or r-xr-xr-x won't execute.
  • Nothing may provide a workaround to run them anyway automatically …

Update

  • 18.04 problem persist, accepted answer still work.
  • 19.04 problem persist, accepted answer no longer work (you must replace yes by true, however after reboot, .desktop not executable)
  • 20.04 use true instead of yes in accepted answer, or right-click "allow execution" from desktop (this might be troublesome for generated .desktop)

Best Answer

I found my desktop files being mentioned in a binary file called ~/.local/share/gvfs-metadata/home which I could not edit. However, after some digging, I found the gio command. Run the following command followed by doing a refresh in nautilus

gio set yourfile.desktop "metadata::trusted" yes
Related Question