【问题标题】:Why can I remove file without user permission?为什么我可以在未经用户许可的情况下删除文件?
【发布时间】:2014-07-24 22:42:47
【问题描述】:

我做了一个小测试来检查权限是如何工作的:

test@comp ~/Documents $ touch test1
test@comp ~/Documents $ ls -l
-rw-r--r--  1 test test     0 Jul 24 22:14 test1
test@comp ~/Documents $ chmod 044 test1 
test@comp ~/Documents $ ls -l
----r--r-- 1 test test 0 Jul 24 22:14 test1
test@comp ~/Documents $ cat test1
cat: test1: Permission denied
test@comp ~/Documents $ rm test1
rm: remove write-protected regular empty file ‘test1’? y
test@comp ~/Documents $ ls -l
total 0

我的问题是,为什么当我对用户没有权限时,我无法读取文件但我可以删除它?

【问题讨论】:

    标签: linux bash permissions console


    【解决方案1】:

    为了删除文件,需要对包含该文件的目录拥有写入权限。
    欲了解更多信息:http://linuxcommand.org/lts0070.php

    【讨论】:

      猜你喜欢
      • 2022-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-03
      相关资源
      最近更新 更多