Can I customize for a perl script?

I made a perl script to change the owner of a file owned by another user. script completed. My administrator will save this in the / sbin directory and set the uid for it using chmod u + s name_of_script. But when I run this script, it gives me an error that the chown operation is not allowed. I made a C program and it works by following the same steps. So my question is: if setuid works for perl, then I should not get this error, because the C code did not give me any error. So I can install setuid for perl script, or I have to go with c code.

Do not tell me to ask the administrator to change ownership every time. Actually, I have a username on the server, and I host the joomla site on it. Now, when I install some kind of plugin, the files associated with this plugin belong to www-data. Therefore, I do not want to contact the administrator every time. Or you can give me another solution regarding my problem.

Thanks.

+4
source share
2 answers

Many unix systems (perhaps the most modern) ignore the suid bit in interpreter scripts, as it opens up too many security holes.

, perl < 5.12.0, perl setuid set, root. , perl , , , setuid, suidperl. Suidperl Perl- - . suidperl setuid.

, taint- . . , , :

Insecure $ENV{PATH} while running setuid at ./foobar.pl line 3.

perlsec .

suidperl . , . , :

Can't do setuid (cannot exec sperl)

- sudo . , , sudoers.

perl 5.12.0, suidperl . , perl script on perl >= 5.12.0 setuid set, C-. sudo .

+6

, setuid aka chmod +s . script , setuid, . .

-, Perl setuid, C-, setuid, Perl script. , setuid script, , .

+5

Source: https://habr.com/ru/post/1525567/


All Articles