Hi all,
I'm trying to better understanding how SUID works.
The theory I guess that I already totally understand:
While a file has the SUID bit set on, then while another user, not it's owner) trying to execute it, it will be run (if the file has the "s" permission) via the file owner permissions - though in a script case, the owner will still be the user that running it.
Though, for executing this file, does the other "zone" in the permissions bar MUST grant execute permission as well?, why is that?
I tried to do as below:
1st session:
Code:
root@Every1:/$ touch ~yoni/test.sh
root@Every1:/$ echo "#"'!'"/bin/bash" > ~yoni/test.sh
root@Every1:/$ echo "gedit empty" >> ~yoni/test.sh
root@Every1:/$ chmod 4744 ~yoni/test.sh
2nd session:
Code:
CrAzYoNi@Every1:~$ ./test.sh
bash: ./test.sh: Permission denied
1st session:
Code:
root@Every1:/$ chmod 4745 ~yoni/test.sh
2nd session:
Code:
CrAzYoNi@Every1:~$ ./test.sh
*Works... *
Thanks for your help!! :-)