I made a perl script to change owner of a file owned by some other user. Script is complete. My administrator save that in /sbin directory and set uid for it using chmod u+s
No, you cannot use setuid
aka chmod +s
on scripts. The script's interpreter would be the thing that would actually need to be setuid
, but doing that is a really bad idea. REALLY bad.
If you absolutely must have something written in Perl as setuid
, the typical thing to do would be to make a small C wrapper that is setuid
and executes the Perl script after starting. This gives you the best of both worlds in having a small and limited setuid
script but still have a scripting language available to do the work.