Suppose root user is setting a file script.sh with SUID permission and allowing others to have execute permissions as follows:
#ls -l /script.sh
-rwsr--r-x root root ---- script.sh
And then he is writing a script as follows:
Now, a normal user is logging in and executes that file:
#su - normaluser
touch: cannot touch `/root/newfile.txt': Permission denied
Actually, after setting SUID to a script, and if a normaluser executes that file, he should be able to write a file inside /root directory, since the effective UID is that of root user's. why is it not happening in this case? Please help.