I'm pretty confused about how file permissions work on Linux. I've seen tons of posts saying that a file with execute permission can run like a program, but a lot of those explanations are outdated, and they just leave me more puzzled. For instance, if I run 'chmod +x some-program' and then execute it with './some-program', what can that program really do? Can it read and write files, send HTTP requests, and so on? I'm really new to this, so any explanation about the capabilities of a file once it has the execute permission would be super helpful!
2 Answers
It seems like there might be a misunderstanding about file permissions! The execute permission lets a user run the file as a program, but it doesn't control what the file can do on its own. Once the file is executed, the actions it can take depend on the user's permissions who runs it. So, if you're running it, it can only access files or resources that you have permission for!
You pretty much nailed the basics! The execute permission just means the file can be run by the system. When it runs, it executes whatever code is in there. If the code tries to access files or networks, it'll do so based on the permissions of the user running it!
So if I'm logged in as a regular user, the program can only access what I can access? Got it!