![]() Registered Member ![]()
|
In konqueror and/or dolphin, I'm so used to double-clicking on text files that I also occasionally double-click by mistake on a shell-script with the executable-flag set when I actually want to edit the script. This can be a problem. Is there a way to disable the file-manager's execution of shell-scripts?
|
![]() Administrator ![]()
|
You could try changing the file association. Konqueror > Settings > Configure Konqueror > File Manager > File Associations. Look for an association containing "sh" under Applications.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Thanks, but no luck so far. I tried that in both KDE 3.5.9 (Mandriva 8.1) and KDE 4.2.2 (Mandriva 9.1) and for "sh", there is the association "x-shellscript". (My scripts are listed as type "shell script" in the file-view, whether they have the "sh" extension or not). In x-shellscript's embedding-tab there are options: "use settings for application group" (the default), "show file in embedded viewer", and "show file in separate viewer". I tried both of the latter options for both versions of KDE, and although the option changes were retained even after restarting KDE, the shell-scripts continued to execute on a double-click. Am I misunderstanding the intent of those options or are the options broken? |
![]() KDE Developer ![]()
|
You could check whether one of the Kiosk restrictions work
http://websvn.kde.org:80/trunk/KDE/kdel ... rev=444344 Or make sure the scripts don't have the execution bit set, e.g. by mounting the respective paritions with noexec Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
![]() Registered Member ![]()
|
Thanks. No luck so far. I tried adding some of the suggested KDE Action Restrictions in that document to kdeglobals: shell_access=false -- but that stopped konsole from starting and disabled Autostart scripts, which was too restrictive. action/executeshellcommand=false -- that just removed an item from the tools menu, but the scripts still executed on double clicks. The problem is that I occasionally double-click by mistake on shell-scripts with the executable-flag set, and I want to guard against that. I can't mount the partitions with noexec because they are scripts that need to be executable on the same machine. |
![]() Registered Member ![]()
|
Is there a way to manipulate the magic file recognition so that shellscripts simply aren't recognized as such? Is there a database file that can be hacked to accomplish this?
|
![]() Administrator ![]()
|
Try running the following command aganist the shell scripts:
Then search for the mimetype it returns in file associations.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Thanks. That identified the files a bit differently, but it led me to find kfile, which seems to identify the mimetypes in the same way as konqueror. When identifying shellscripts, it warns:
What does that warning mean? Is it possible to hack some file to alter the recognitions? |
![]() Administrator ![]()
|
It is probably possible, but I wouldn't know how to, modify a files mimetype. It might be determined on the fly, in which case it is impossible.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
I've cracked the original problem for KDE3, but not KDE4.
KDE3: In the file: /usr/share/mimelnk/application/x-shellscript.desktop comment out the line: X-KDE-IsAlso=application/x-executable-script And shellscripts stop executing on double-clicks in the file-manager. The only untoward effect I've noticed was that a script in .kde/Autostart stopped executing, but I fixed that by creating a .desktop link to it. That's fine. The only time I want to execute shellscripts is from konsole or from icons that I've added to a quick-browser menu. In KDE4, I found the apparent equivalent, and in the file: /usr/share/mime/application/x-shellscript.xml I deleted the line: But that didn't make any difference, even after rebooting. |
![]() Administrator ![]()
|
You may need to force a rebuild of the Sycoca.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Thanks. I've now cracked the problem for KDE4 too.
I realized that something needed to be rebuilt when I saw a note in the top of the file that I changed, saying that it was auto-generated and should not be edited. I followed the info in the note and found: /usr/share/mime/packages/freedesktop.org.xml To stop shellscripts executing on double-clicks in the file-manager, I needed to edit that file. It contains all the mime definitions (including all the "magic" tags for recognizing the files by content inspection). The section for shellscripts began with: and there I commented out a line like so: then rebuilt the mime database: [root]# update-mime-database /usr/share/mime Sorted. ![]() |
![]() Registered Member ![]()
|
Hmmm... Just stumbled across this again because it's got a high Google search rating, but it seems that the passage of time has graunched my last post. Something to do with updated forum software not liking the XML syntax, I guess. So here it is in a code box:
Re-start KDE -- and shellscripts no longer execute on double-clicks in Dolphin. |
![]() Registered Member ![]()
|
Thank you Farry !!!
You are a hero for me! That was exactly the solution! When I click on my scripts from Konqueror is only because I want to read/modify them - the choice to execute them upon click just don't make any sense for me! |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]