-2

Whats different "name.txt" vs "name.txt " in Linux?

If I rename name.bin to name.txt - is normal and file doesn't executable.

If I rename name.bin to file.txt (with space after filename) - file will be executable.

closed as unclear what you're asking by Jeff Schaller, Isaac, Romeo Ninov, jimmij, Thomas Oct 21 '18 at 11:41

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Please prove that assertion, as it is a bit difficult to believe. – RudiC Oct 20 '18 at 15:41
  • what did you use to "rename" name.bin to file.txt\ ? if you use cp name.bin file.txt\ and file.txt\ already exists and is executable, it will stay that way; cp without the -p flag won't change its permissions. – mosvy Oct 20 '18 at 15:42
  • Perhaps you're failing to invoke the correct filename? Demonstrate what you're doing so we can follow along. – Jeff Schaller Oct 20 '18 at 17:33
  • @ctrl-alt-delor attack.mitre.org/wiki/Technique/T1151 – 0-Level UNIX Monk Oct 20 '18 at 17:54
  • @interesting, but not a Linux thing, it is a file manager thing. So you are changing weather the file-manager attempts to execute it (not weather it is executable). A simpler solution is to prevent downloaders from setting the execute bit. – ctrl-alt-delor Oct 20 '18 at 17:59
2

Whether the file is executable (or not) is a matter of permissions, not of the name.

Use chmod a+x to make it executable and chmod a-x to disallow it. Full details here:

https://unix.stackexchange.com/a/297014/255708

Not the answer you're looking for? Browse other questions tagged or ask your own question.