SUID issue

i am trying to understand a basic about SUID
i want to run a script to copy file to a directory which owned by root
files will be copied from directory one to myroot directory.
permission of my root is as follows :
[root@/]# ls -l  | grep myroot
drwxr-xr-x   2 root   root    4096 May 13 12:51 myroot
the script permission is as follows :
[root@ /]# ls -l
-rwsrwxrwx 1 root root 30 May 13 12:51
so i have sent suid to root, chmod u+s
now i am trying to run this script as normal user, but its unable to copy file in myroot directory as its saying permission denyed

but as a rule, if i set suid , so the script should run as Root previliges, then why still its unable to copy ??
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

woolmilkporcConnect With a Mentor Commented:
The link above is a bit misleading. The article mainly deals with a 'what if ...' scenario (what if setuid was possible with shell scripts).
Here is another, maybe better thingy -
the Linux kernel will not honour the setuid bit on shell scripts, as this could be a  major security issue!
setuid is only honoured with binaries.
yusuf01Author Commented:

by binaries you meant, programm such as sendmail or user defined program written by C or something like that??

then what about thsi article

every where its saying "shell script"
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

With 'binaries' I mean compiled code. Sorry for not having been clear enough.
OK, it seems that I am right, since your script doesn't run as expected, does it?
Maybe there are Unix'es around which allow setuid for scripts, but I am not aware of any.
You could circumvent your problem either by using 'sudo' to start the script or by writing a small wrapper in C around the script employing 'popen' or 'execl' or 'system'.
yusuf01Author Commented:
you could be right, i just read for mandrive , it does not support script to use suid...

but its wired , every example in web for suid is showing for script, i never seen any site is saying that suid does not support sciprt ....

yusuf01Author Commented:
let me come back from launch, then will read that link
yusuf01Author Commented:
yes the 2nd link is realy good
thanks to share information with me.
i will close this question now
All Courses

From novice to tech pro — start learning today.