相关疑难解决方法(0)

SUID不使用shell脚本

我创建了一个包含以下内容的小shell脚本:

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
Run Code Online (Sandbox Code Playgroud)

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

-rw-r--r-- 1 root root 6 Sep  9 12:26 /etc/myfile.cnf
Run Code Online (Sandbox Code Playgroud)

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

/usr/bin/checksuid.sh: line 3: /etc/myfile.cnf: Permission denied
Run Code Online (Sandbox Code Playgroud)

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

linux bash shell suid

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

bash ×1

linux ×1

shell ×1

suid ×1