This question already has an answer here:
- Allow setuid on shell scripts 8 answers
I am learning about setuid and setgid where the user executing the script will inherit the owner's permission while running the script. To test this, I created a bash as user fiverr in /home/fiverr/test.sh with permision 4755.
rwsr-xr-x 1 fiverr fiverr 39 Dec 6 13:47 /home/fiverr/test.sh
It contains the following:
#!/bin/bash touch /home/fiverr/raza.txt
I logged-in as me (raza) and try to execute it but I get permission denied. How come?
touch: cannot touch ‘/home/fiverr/raza.txt’: Permission denied