5

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)
Archemar
  • 672
  • 2
  • @JoKeR I did set +x bit .. – Archemar Oct 25 '17 at 20:51
  • Did you read the policy from the answer mentioned in that post? – JoKeR Oct 25 '17 at 20:58
  • @JoKeR I have that too, with files which permissions are set to 755 so this is not a dupe, its something new with 17.10 – Videonauth Oct 25 '17 at 21:09
  • might be reported as a bug then... – JoKeR Oct 25 '17 at 21:15
  • Just on what to report it to? I did a fresh install only pulled over a few files and settings. Seems like an additional security layer. I have here a .desktop file I already trusted and when I delete it and pull over the same file from the backup, I have again to trust it. Checking the file with statreveals that nothing is different between those both files. Maybe it has to do with lightDM not being the desktop manager anymore and gdm3 treating files with an extra security layer. – Videonauth Oct 25 '17 at 21:24
  • Same problem here, chmod 777 && chown ${USER} but still not "trusted", I hope it is a bug, otherwise it means they want us to manually "trust" every application which would be very irritating. The message is different from when the executable flag isn't set. I've included a screenshot trying to open the same file without (top) the executable bit and with (bottom) the executable bit. https://imgur.com/a/dKEaJ – Caleb Nov 03 '17 at 13:37

1 Answers1

8

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
pomsky
  • 68,507
  • does it work for you? – Pierre.Vriens Jan 14 '18 at 08:04
  • 4
    hardest part was to find F5 command to refresh desktop :( – Archemar Jan 14 '18 at 17:27
  • It worked for me, but only AFTER I did a refresh. This has been an irritation to me for several weeks before I finally found this solution. I hope it works for everyone. – Byron Smith Jan 15 '18 at 03:13
  • 1
    for all icons, do this ls -1 ~/Desktop/*.desktop | xargs -i gio set "{}" "metadata::trusted" yes and then hit the F5 key to refresh – knb Oct 24 '18 at 15:22
  • 1
    I think this no longer works in 18.04 or 18.10. I don't know what the new solution is. – Byron Smith Dec 28 '18 at 07:13
  • Ubuntu 18.04.5 LTS with this disgusting "Gnome" I was partly successful doing this: copy (not link) the .desktop from /usr/share/applications/ into /home/user/Desktop ; make it owned by user ; make it x-ecutable for all ; then run the gio command as shown above ; thanks a lot @knb for the great little helper ( ls -1 ~/Desktop/*.desktop | xargs -i gio set "{}" "metadata::trusted" yes ) great (& lets hope for a soon end of pain called "GNOME"). – opinion_no9 Dec 19 '20 at 21:39
  • As far as I know, this no longer works on 20.04+. – Byron Smith Feb 02 '21 at 02:55