3

This is related to questions like “How do I run executable scripts in Nautilus?” or “How to execute a script just by double clicking like .EXE files in Windows?”.

I would also like to have shell scripts run if they are opened in the file manager (Nautilus), but the usual setting (org ➤ gnome ➤ nautilus ➤ preferences ➤ executable-text-activation) is not fine-grained enough for my purposes. If I set it to ask or launch, any text file with the executable bit set will (ask to) be launched as a script. This is problematic because we have some scripts on a file system (CIFS) which does not support Unix permissions (owner/group, rwx). That means that when I mount this file system, I can only either

  1. set all files as executable (including, of course, any text files) or
  2. set all files as not executable.

Consequently, when I open any text file (*.txt/MIME type text/plain), even if it has no script-related contents, the file will still (ask to) be executed. This is really annoying and irritating for inexperienced users – of course I don’t want to “run” a text/plain file.

Is there a way to make Nautilus treat only actual shell scripts (e. g. MIME type application/x-shellscript) as executable scripts?

Socob
  • 839
  • 1
  • 9
  • 18
  • You can mount the remote files system without the executable bit on regular files as you mention in the question. Or is that unacceptable for some reason? – David Foerster Dec 14 '17 at 20:46
  • @DavidFoerster As I said, there are both normal text files and shell scripts on the remote file system. If I mount without the executable bit set, the scripts cannot be executed at all anymore. – Socob Dec 16 '17 at 11:59
  • Fair enough. Though one can always run scripts directly through their interpreter (e. g. bash my-script instead of ./my-script). – David Foerster Dec 16 '17 at 13:54
  • @DavidFoerster Yeah, I guess that’s true. Doesn’t help me with launching from the file manager GUI, though… – Socob Dec 17 '17 at 17:19

0 Answers0