这是代码:
(根:)
# mkdir /test
# cp /bin/bash /test/sbash
# chmod a+s /test/sbash
Run Code Online (Sandbox Code Playgroud)
(用户 1:)
$ cd /test
$ ./sbash
$ mkdir trycreate
mkdir: cannot create directory `trycreate': Permission denied
Run Code Online (Sandbox Code Playgroud)
设置了 setuid 位的 bash 脚本也不起作用。
顺便说一句,我的 setuid perl 脚本有效:
test.pl:(设置了 setuid 位,owner=root)
#!/usr/bin/perl
mkdir('/test/tryperlcreate') or die 'failed';
Run Code Online (Sandbox Code Playgroud)
由 user1 执行 test.pl 将创建 root 拥有的目录。
您不能将脚本设为 SUID。幸运的是。
不过,您可能对此处的 SUID 包装程序感兴趣:http : //isptools.sourceforge.net/suid-wrap.html
我还应该补充一点,请在执行此操作之前确保您确实需要执行此操作。SUID 二进制文件可能是您系统中的一个巨大漏洞。
我可以重新发布已经死了的东西,但这是一个很好的阅读。
基本上 setuid shell 脚本在默认情况下不起作用
http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html
尝试使用 -p 执行 ./sbash。
sh:~# cp /bin/bash /bin/ape
sh:~# chmod +s /bin/ape
sh:~**$** /bin/ape -p
ape-3.2#
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22118 次 |
| 最近记录: |