min*_*001 8 rhel setuid permissions
用户对文件具有只写权限,无法cat
或vi
但能够nano
正常。这怎么可能?
我想知道如果你只有一个文件的写访问权限会发生什么,这就是我测试它的方式。
# cd /home/tester
# cat hello.txt
Hello World!
# ls -l hello.txt
-rw------- 1 root root 13 Nov 17 01:55 hello.txt
# chmod o+w hello.txt
# ls -l hello.txt
-rw-----w- 1 root root 13 Nov 17 01:55 hello.txt
# su tester
$ cd ~
$ cat hello.txt
cat: hello.txt: Permission denied
$ nano hello.txt
Run Code Online (Sandbox Code Playgroud)
出于某种原因,nano
能够读取文件(见截图)。我已经确认vi
不是。我最初的假设是,拥有只写权限允许您只附加像echo "Hello" > hello.txt
.
(有关我运行的实际命令,请参阅此屏幕截图。)
ls -l "$(type -p nano)"
显示权限-rwsr-xr-x root root
。
小智 10
-rwsr-xr-x root root
结果ls -l "$(type -p nano)"
是setuid。因此,无论谁运行 nano 都拥有 root 权限。这不是预期的,也不应该在任何正常环境中发生。与您的管理员一起了解重点是什么。