Redian新闻
>
how to use setuid permission for a perl program?
avatar
how to use setuid permission for a perl program?# Unix - 噫吁兮,危乎高哉
s*l
1
I have a perl program which will create a file. I set the setuid permission
for the perl program, say: chmod 6755 myperl.pl
Then, when I execute it as other users, either the created file is owned by
another user (say, root), or an error happened and the program can not be
run by others:
Insecure ENV{$PATH} ....
How to deal with this? Thanks a lot.
avatar
p*f
2

you are adviced to explicitly set the $PATH env var in a setuid perl
program, read 'man perlsec' for details.

【在 s*******l 的大作中提到】
: I have a perl program which will create a file. I set the setuid permission
: for the perl program, say: chmod 6755 myperl.pl
: Then, when I execute it as other users, either the created file is owned by
: another user (say, root), or an error happened and the program can not be
: run by others:
: Insecure ENV{$PATH} ....
: How to deal with this? Thanks a lot.

avatar
s*l
3
What if the perl tries to install some program? Who will be the owner?
Thanks a lot.

【在 p******f 的大作中提到】
:
: you are adviced to explicitly set the $PATH env var in a setuid perl
: program, read 'man perlsec' for details.

avatar
p*f
4
the owner of the perl executable, if setuid.
the person who runs the executable, otherwies.

【在 s*******l 的大作中提到】
: What if the perl tries to install some program? Who will be the owner?
: Thanks a lot.

avatar
o*z
5
save the effective uid at the beginning by $euid=$EUID (if you use English)
then set it back to the real UID by saying $EUID=$UID
switch back to enhanced permission by $EUID=$euid only when necessary
and reduce to normal permission as early as possible

【在 s*******l 的大作中提到】
: I have a perl program which will create a file. I set the setuid permission
: for the perl program, say: chmod 6755 myperl.pl
: Then, when I execute it as other users, either the created file is owned by
: another user (say, root), or an error happened and the program can not be
: run by others:
: Insecure ENV{$PATH} ....
: How to deal with this? Thanks a lot.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。