SUID不与shell脚本工作 [英] SUID not working with shell script

查看:207
本文介绍了SUID不与shell脚本工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个小的shell脚本,内容如下:

I have created a small shell script with the following content:

cat /usr/bin/checksuid.sh

!/bin/bash
echo "Hello" > /etc/myfile.cnf

ls -l /usr/bin/checksuid.sh
-rwsr-xr-x 1 root root 56 Sep  9 12:56 /usr/bin/checksuid.sh

我也创建了一个文件 /etc/myfile.cnf 用root帐户并设置权限如下:

I have also created a file /etc/myfile.cnf with root account and set permissions as below:

-rw-r--r-- 1 root root 6 Sep  9 12:26 /etc/myfile.cnf

当我执行 /usr/bin/checksuid.sh 从非root帐号,我得到以下错误:

When I execute /usr/bin/checksuid.sh from a non-root account, I get the following error:

/usr/bin/checksuid.sh: line 3: /etc/myfile.cnf: Permission denied

能有人帮助你,为什么SUID不工作?

Can some one help you that why SUID is not working?

推荐答案

Shell脚本不能SUID。见<一href=\"http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html\">http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html

Shell scripts can't be SUID. See http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html

这篇关于SUID不与shell脚本工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆