EDIT: this Sticky bit enabled Script can't write to a root file appears to be a similar problem
EDIT: How can I use SetUID on a shell script to run as a non-root user? is very similar as well.
I have a script, let's call it read.sh. I have a file, lets call it secret.
# cd /home/normie
# echo "some stuff" > secret
# echo "#!/bin/bash" > read.sh
# echo "cat secret" >> read.sh
# chmod 600 secret
# chmod 4755 read.sh
# su normie
$ ./read.sh
<<Error about not having access to secret>>
Did I miss something? I thought the SUID bit made the script run as the owner? When I run the following
# echo "touch newfile" > sumfile.sh
# chmod 4755 sumfile.sh
# su normie
$ ./sumfile.sh
$ ls -alh
<<newfile shows as owned by root>>
What is going on here, and how do I make it work the way I want? The way I want being, I want regular users to execute a particular script with full root access. (I thought that's what the suid bit did )