First, you need to have root privileges to do this. Second you don't need executable permissions on the files in /usr/share/applications
. A simple ls -l
on the directory on my own machine shows this:
$ ls -l
total 2864
-rw-r--r-- 1 root root 5511 Dec 19 08:14 alacarte.desktop
-rw-r--r-- 1 root root 3417 Dec 17 15:21 assistant-qt5.desktop
-rw-r--r-- 1 root root 14329 Jan 23 13:37 bamf-2.index
-rw-r--r-- 1 root root 296 Nov 2 2015 bastet.desktop
-rw-r--r-- 1 root root 6305 Jan 16 2017 bleachbit.desktop
-rw-r--r-- 1 root root 6333 Aug 30 13:38 bleachbit-root.desktop
...
Note that none of the above files are executable; in other words, files which are present in application directories like /usr/share/applications
or ~/.local/share/applications
are not executable because no one is going to execute them. Files in your Desktop folder are executable so you can execute them but no one goes in /usr/share/applications
to run an application.
Let's solve the first problem:
You can become root by running sudo -i
and then entering your user password. Once you are root, you can create the desktop file with either
# gedit /usr/share/applications/[file].desktop
Or
# nano /usr/share/applications/[file].desktop
Now you can enter the contents of the file as you desire.