I'm trying to test cap_dac_override. I've written a simple hello world. I've compiled the program and I've removed all the permissions from the executable. At this moment I'm not able to execute my program by running ./hello which is correct. Now I would like to apply a capability so that the program can still be executed even though the user has no execute permission.May I ask how set up cap_dac_override so that I can still execute the program, or am i using cap_dac_override completely wrong?setcap cap_dac_override=ep hello
How use cap_dac_override from libcap
linux
You are confusing capabilities and permissions.The file mode bits or permissions describe what can be done with a file. When you removed all permissions from a file you instructed the OS that you don't want anyone to read from it, write to it or execute it.File capabilities on the other hand describe what a file can do or to be exact, what a process originating from that program file can do, what it otherwise wouldn't be able to do.With setcap cap_dac_override=ep hello you allowed the program hello to override the usual permission checks when it runs. But that doesn't change that the usual permission checks are applied when trying to execute hello.