Can i setuid for perl script?

后端 未结 2 898
[愿得一人]
[愿得一人] 2021-01-19 19:29

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

2条回答
  •  面向向阳花
    2021-01-19 20:07

    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.

提交回复
热议问题