- 论坛徽章:
- 0
|
本帖最后由 yingweixu 于 2011-08-24 15:10 编辑
系统环境是 Centos5.4,我测试 chmod u+s 在自己写得脚本上没效果?
1. 首先我像网上的教程一样 chmod u+s,g+s /bin/touch , 然后使用普通用户去 touch /opt/123.txt ,这是成功的。
$ ll /opt/123.txt
-rw-r--r-- 1 root share_group 0 Aug 24 14:57 /opt/123.txt
2. 然后我将 /bin/touch 恢复回原来的权限,写了一个脚本 test.sh ,这时候再给 test.sh 赋予 特权位,可是却测试失败了,求原因;
具体操作:
[wayne@VIA_02_S_06 opt]$ cat test.sh
#!/bin/bash
FNAME="$1"
touch /opt/$FNAME
[wayne@VIA_02_S_06 opt]$ ll test.sh
-rwsr-sr-x 1 root root 41 Aug 24 14:16 test.sh
[wayne@VIA_02_S_06 opt]$ ./test.sh 123.txt
touch: cannot touch `/opt/123.txt': Permission denied |
|