Suppose i have two files
total 8
-r-sr-xr-x 1 root root 34 Oct 8 17:36 openroot.sh
-rwx------ 1 root root 38 Oct 8 17:34 root.txt
Content in root.txt :
Hi I am root file.
Content in openroot.sh :
#!/bin/bash
whoami
cat root.txt
And now i am regular user (for example : person1). I execute command below:
./openroot.sh
The output is below :
person1
cat: root.txt: Permission denied
which means i cannot open root.txt. How does it happen?