重定向(大于号)不是 echo 的功能,而是 shell 的功能。
【 在 BlackDead 的大作中提到: 】
: 关于setuid的疑问:
: 比如有一个文件1.txt, 只有root有写入权限:
: $ll 1.txt
: -rw-r--r--. 1 root root 57 Jul 1 12:19 1.txt
: 为了让普通用户能写入,对echo执行以下命令:
: $ sudo chmod u+s /usr/bin/echo
: $ ll /usr/bin/echo
: -rwsr-xr-x. 1 root root 33128 Oct 31 2018 /usr/bin/echo
: 然后一个普通用户运行以下命令还是报错:
: $ echo 111 > 1.txt
: bash: 1.txt: Permission denied
: 不是说setuid后就能取得程序owner相同的权限了吗? 这里为什么会报错 ?
: ====================
: 对ls命令做了类似的测试:
: test目录只有root有读写权限
: $ ll -d test/
: drw-------. 2 root root 34 Jul 1 14:18 test/
: 一般用户ls时会报错:
: $ ls test/
: ls: cannot open directory test/: Permission denied
: setuid:
: $ sudo chmod u+s /usr/bin/ls
: $ ll /usr/bin/ls
: -rwsr-xr-x. 1 root root 117680 Oct 31 2018 /usr/bin/ls
: 然后一般用户就可以对test目录执行ls了
: $ ls test/
: 1 23 4
: echo和ls有什么不同呢? 为什么结果会不一样
--
FROM 163.125.197.*