yang97e 发表于 2003-9-30 21:38:26

RM 竟然可以删除其他用户的文件

本人在用RM 命令时, 发觉 RM 竟然可以删除其他用户的文件和目录(例如Root的文件),即使将文件的权限改成 000,这样确实连读都不可以了,但依然可以删除,只是会提示“是否删除Write-Protected的文件”,按Y就删掉了

大家做以下操作便可验证:
用普通用户建立一个文件,例如 test
用Root 修改用户,组,和权限, 即:
chown root test
chgrp root test
chmod 000 test

这样test文件便是Root,Root,权限是000,普通用户确实不能访问了
但用rm test却可以删除,只是会提示“是否删除写保护的文件”,按Y就删掉了



非常不理解,这样文件权限不是没有意义了吗?

请高手解答

neptune 发表于 2003-10-1 21:01:19

不会呀
# chmod 000 1
# ls -l
总用量 64
----------    1 root   root         27378月2 21:02 1

......

# su ning
$ ls
ls: .: 权限不够
$ vi 1   ---------> vi显示1 "未命名"
$ rm 1
rm: lstat‘1’失败: 权限不够
$

root用vi看文件1,显示1 "只读"

yang97e 发表于 2003-10-2 10:06:51

要先用普通用户建立文件,再用ROOT 去改

HACKGOU 发表于 2003-10-2 16:09:15

linux下root是无所不能的。
你是不是用root做的那些rm?

yang97e 发表于 2003-10-2 16:12:37

不是, 确认是用普通用户做的

HACKGOU 发表于 2003-10-2 16:48:29

let me try agin

HACKGOU 发表于 2003-10-2 16:53:23

呵呵,这是我的结果:
HACKGOU:~$whoami
hackgou
HACKGOU:~$ll >test
HACKGOU:~$ll test
-rw-r--r--    1 hackgouhackgou      4672 10月1 16:26 test
HACKGOU:~$chown root test
chown: changing ownership of `test': Operation not permitted
HACKGOU:~$su
password:

HACKGOU:/home/hackgou#whoami
root
HACKGOU:/home/hackgou#chown root test
HACKGOU:/home/hackgou#chgrp root test
HACKGOU:/home/hackgou#chmod 000 root
HACKGOU:/home/hackgou#ll test
----------    1 root   root         4672 10月1 16:26 test
HACKGOU:/home/hackgou#su hackgou
HACKGOU:~$whoami
hackgou
HACKGOU:~$ll test
----------    1 root   root         4672 10月1 16:26 test
HACKGOU:~$rm test
rm:remove protect-write fiel'test'?   Y
HACKGOU:~$lltest
ls:test:no such file or directory
呵呵,为什么呢??
看这个:
HACKGOU:~$ ll ..
total 4
drwxr-xr-x   48 hackgou hackgou      4096 10月1 16:38 hackgou

HACKGOU 发表于 2003-10-2 16:56:18

Toyang97e:

你是在别人的$HOME$里面做的实验吧。
人家的$HOME$
当然是RWX全可以阿。

yang97e 发表于 2003-10-3 10:43:13


呵呵,为什么呢??
看这个:
HACKGOU:~$ ll ..
total 4
drwxr-xr-x   48 hackgou hackgou      4096 10月1 16:38 hackgou

what does this means?

you mean in $home$, the home owner has absolute right??

yang97e 发表于 2003-10-3 11:25:23

谢谢HACKGOU
我终于明白了

其实对文件的操作(cp, rm, mv)其实是对文件所在目录的操作,要看目录的属性

文件的属性是对文件本身内容的操作

之所以能删除是因为普通用户对$home$为 RWX,所以当然可以!!

HOUSCOUS 发表于 2003-10-3 11:29:32

因为它是在你的文件目录建立的文件, 你对任何在你的目录里的文件都有权力. 你试试用另一个用户名在他自己的目录里建立文件, 然后再用你现在的用户名去试试看.
页: [1]
查看完整版本: RM 竟然可以删除其他用户的文件