I created a script, and I want it to be rwx only by root. All other can only x. What I have now
[root@localhost /]# chmod 755 scripts/ -v
mode of 'scripts/' retained as 0755 (rwxr-xr-x)
[root@localhost /]# chmod 711 scripts/macchange -v
mode of 'scripts/macchange' retained as 0711 (rwx--x--x)
And I think all is good here. If I go with my user I can read the folder content, but not the files. But when I'm trying to exec the script this is what I get
[iron@localhost /]$ ./scripts/macchange
/bin/bash: ./scripts/macchange: Permission denied
What am I doing wrong? If I give my user permission to read it suddenly works.
Explanation why it's different then the possible duplicate: I didn't realize bash needs to read the file to execute it. I thought it's an issue of folder to file permissions.