1

I can't remember how i have made all .txt files on my external hard-drive with NTFS executable in Ubuntu, so that whenever i double-click any .txt file on that disk or open the right-click menu, it only appears to run the file instead of trying to open it with text editor applications.

I can see an option "allow executing file as a program" in the file properties is checked, but i can't uncheck it by click (it automatically gets checked again).

I have tried the following command but it doesn't work:

chmod -x *.txt

How can i revert my txt files configuration back to normal behaviour?

ibuprofen
  • 2,781
  • 1
  • 14
  • 33
Sina
  • 121
  • 5
  • You need to be the owner to alter permissions. A file called "something.txt" can be a genuine script file which is meant to be executable, although a very badly badly named one. You could try sudo chmod -x *.txt which will make every .txt file in your current directory non-executable. – Jeremy Boden Jul 02 '21 at 23:00
  • @JeremyBoden i'm the owner. adding sudo didn't change anything. i see this problem in all my text files, not just txt files having codes or scripts. – Sina Jul 02 '21 at 23:08
  • "when I double click..." - so you are running a desktop environment. Whilst it is probably gnome, you need to tell us which one it is. – icarus Jul 03 '21 at 00:00
  • Do you have a "properties" menu item on the right-click menu? – icarus Jul 03 '21 at 00:04
  • What filesystem are these files on? – Joseph Sible-Reinstate Monica Jul 03 '21 at 01:37
  • Are the text files in a directory mounted from a windows file share or a partition (or disk or usb thumb drive etc) formatted as FAT or NTFS? – cas Jul 03 '21 at 02:32
  • @icarus yeah it's gnome in ubuntu 20 – Sina Jul 04 '21 at 18:20
  • @cas now that i see, only the txt files in my NTFS external HDD have this problem. the files on my system are doing ok. – Sina Jul 04 '21 at 18:21
  • OK, you need to change the permission that are set when the NTFS drive is mounted. Find the line that mounts it in `/etc/fstab`. You'll want to add or change the `fmask` value so that regular files aren't executable. There's a good answer about this at [fstab mount options for umask, fmask, dmask for ntfs with noexec](https://unix.stackexchange.com/a/521072/7696) – cas Jul 05 '21 at 01:01
  • Does this answer your question? [fstab mount options for umask, fmask, dmask for ntfs with noexec](https://unix.stackexchange.com/questions/396904/fstab-mount-options-for-umask-fmask-dmask-for-ntfs-with-noexec) – cas Jul 05 '21 at 01:02
  • Does this answer your question? [Chmod is not working on ntfs-3g partition](https://unix.stackexchange.com/questions/604674/chmod-is-not-working-on-ntfs-3g-partition) – muru Jul 05 '21 at 08:59
  • @cas i don't know much about Linux configuration. the links have actually confused me with their complexity. i don't quite understand what command to run in my terminal to solve this problem. – Sina Jul 05 '21 at 12:14

0 Answers0