I never understood this, because if you have access to read a file, doesn't that mean you would be able to copy it somewhere else, thus allowing you to execute it anyway?
What am I missing?
I never understood this, because if you have access to read a file, doesn't that mean you would be able to copy it somewhere else, thus allowing you to execute it anyway?
What am I missing?
The Executable flag is there to indicate to the kernel that the data should be read and then run. This is implemented by having a different call for executing something and reading something. For compiled programs it is quite possible to have execute-only access to it and not have read access; you can't even 'cp' them elsewhere. For interpreted items like shell-scripts, read is needed for execution.
I know one Linux distro that uses the execute flag to control what scripts fire at bootup.
In short, the Execute flag is used to indicate the ability of compiled code to run. Interpreted code is run through the parent processor and may only need 'read'.
Some potential reasons:
There are probably other reasons...
doesn't that mean you would be able to copy it somewhere else, thus allowing you to execute it anyway?
No, this is not correct.
There are scenarios when you can't execute a file, even if it has the executable bit set. Here are at least two of them: